55 Commits

Author SHA1 Message Date
e1af2e15cb I18n: Import Scenes translations (#106852)
* wip

* use initScenesTranslations

* comment

* use just plain resource loaded from scenes lib

* update to the published scenes version

* rename loadPluginResources to loadNamespacedResources
2025-06-24 10:00:41 +01:00
e49c73533b I18n: Allow pseudo-locale to be enabled in production builds (#106738)
* I18n: Allow pseudo-locale to be enabled in production builds

* fix tests now that pseudo is around

* remove psuedo locale from i18n package

* load en-us from plugin resources for pseudo

* fix tests + remove 'hidden' option

---------

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2025-06-17 10:55:15 +01:00
09e8484bac i18n: rename locale to regionalFormat (#106585)
* locale -> regionalFormat, mirroring #102233

* set up regionalFormat to replace locale entirely

* replace locale with regionalFormat

* update reportInteraction arguments
2025-06-16 21:53:55 +02:00
23ecb9d904 i18n: Use grafana/i18n to init the locale and manage the regionalFormat (#105281) 2025-05-19 13:24:33 +02:00
119d5897ea i18n: imports use @grafana/i18n (#105177)
* i18n: everything should target @grafana/i18n

* wip

* chore: updates after PR feedback

* Trigger build

* Trigger build

* Trigger build

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: skip flaky tests

* chore: revert all flaky tests

* chore: some incorrect usages of useTranslate
2025-05-15 09:17:14 +02:00
8a2af6166c i18n: adds @grafana/i18n package (#104603)
* i18n: adds grafana/i18n

* Trigger build

* chore: fix frontend lint

* chore: refactor

* chore: refactor

* chore: expose getI18nInstance in shared deps

* chore: refactors away second init

* Trigger build

* chore: updates after PR feedback

* chore: sync with enterprise

* chore: adds shouldUnescape

* Trigger build

* chore: makes functions internal

* Trigger build

* chore: fix for Pseudo locale

* chore: bumps package version

* chore: fix the version of i18n package
2025-05-09 05:45:20 +02:00
10df5d6f23 i18n: unify locale codes to match language structure (#104415) 2025-04-24 11:08:57 +02:00
68c6e4b1e7 i18n: Move locale code behind the feature toggle in internationalization/dates.ts (#103981) 2025-04-16 09:54:10 +02:00
3607356f65 i18n: Update internationalization/dates.ts to use locale (#103731) 2025-04-11 11:24:40 +02:00
4849f87e82 i18n: Add locale to SharedPreferences (#103133) 2025-04-09 17:15:44 +02:00
3de09fe457 i18n: exposes languages in grafana/data (#102958)
* i18n: exposes languages in grafana/data

* Chore: updates after PR feedback
2025-04-07 11:53:04 +02:00
18ae5d7f0c i18n: wires up translations for plugins (#102853)
* i18n: consolidate i18n types & runtime services

* Chore: updates after PR feedback

* Chore: updates after feedback

* Chore: updates after feedback

* Chore: adds feature toggle

* Chore: adds locale to backend

* Chore: adds locales to i18n instance

* Chore: fix missing path in CODEOWNERS

* Chore: fix go lint issues

* Chore: fix missing path in CODEOWNERS

* Chore: updates after PR feedback

* Trigger build

* Chore: updates after PR feedback

* Chore: use resolved language for lookup

* Chore: updates after PR feedback

* Update pkg/plugins/plugins.go

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>

* Chore: updates after PR feedback

* Chore: updates after PR feedback

---------

Co-authored-by: Will Browne <wbrowne@users.noreply.github.com>
2025-03-31 06:38:38 +02:00
3a9370083f I18n: Add 13 new languages for translations (#102971)
I18n: Remove extraLanguages toggle
2025-03-27 12:58:52 +00:00
6822805c32 Grafana Runtime: Use package.json exports for internal code (#102100)
* refactor(frontend): update runtime import paths for grafana/runtime/src -> grafana/runtime

* feat(runtime): introduce internal api entrypoint and exports property

* refactor(frontend): update runtime imports to use internal entrypoint

* chore(betterer): update results file

* refactor(bookmarks): update runtime/unstable import

* chore(betterer): update results file

* test(frontend): fix failing tests due to mocking nested runtime imports

* test(datasourcesrv): fix failing tests due to mocks

* chore(alerting): clean up redundant import

* fix(packages): fix default require export pointing to types declaration file

* docs(packages): update readme related to exports

* chore(internationalization): fix import paths

* chore(betterer): update results file
2025-03-27 08:59:57 +01:00
6f2a9abc03 i18n: consolidate i18n types & runtime services (#102535)
* i18n: consolidate i18n types & runtime services

* Chore: updates after PR feedback

* Chore: updates after feedback

* Chore: updates after feedback

* Chore: updates after PR feedback

* Chore: fix i18n

* Chore: updates after PR feedback
2025-03-24 13:20:00 +01:00
2ece94bc50 Chore: Fix pseudo translations (#102295)
* remove unnecessary pseudo translations

* properly initialise pseudo translations in core (not grafana-ui)
2025-03-17 16:45:36 +00:00
d6c97bd6c9 I18n: Add useT/useTranslate PR feedback that got missed (#102098)
I18n: Add PR feedback that got missed
2025-03-13 12:49:49 +00:00
50ff1ae69b I18n: Add useT hook for plugin translation API (#102033)
* Create placeholder useT function

* expose useT() in @grafana/runtime

* fix setting useT correctly

* example usage of useT

* rename hook to useTranslate

* fix rename

* remove comment
2025-03-13 13:54:57 +02:00
210c886bb7 I18n: Add new language options (#101899)
* Add newLanguages feature toggle

* add additional languages behind feature toggle

* be more forgiving of what config looks like in tests

* tweak regex

* put pt-br back

* restore order of pt-BR and cn-Hans, rename EXTRA_LANGUAGES to NEW_LANGUAGES

* stricter test regex
2025-03-11 12:07:16 +02:00
852243c8f0 Chore: Remove pseudoizer and use i18next-pseudo instead (#101690)
* Remove pseudoizer and use i18next-pseudo instead

* Remove pseudo.mjs script

* Conditionally add pseudo post processing to i18n config

* Remove pseudo-locale in favour of post processing

* Add wrapped property to pseudo strings
2025-03-10 12:02:31 +00:00
5d45af1110 I18n: Add doc comment for t() (#99024)
* Add comment doc

* Reorder information
2025-01-15 17:31:06 +01:00
b662879c98 Internationalisation: Add basic e2e test to ensure languages load correctly (#96556)
* fix pseudo locale and add simple e2e test

* add comment

* update test and add comments

* fix unit test

* try 5 instead of 6?

* clear input

* only check pseudo in dev mode

* don't check pseudo in CI

* don't test pseudo locale

* isolate language changes

* move waits around

* only wait for preferences on first visit

* add proper loading state

* bit of tidy up

* hook up ids correctly

* use disabled/isLoading instead of skeleton

* set props on Field
2024-11-19 15:07:14 +00:00
58907a8464 i18n: Add test to check languages match a canonical locale (#93105)
add test to check languages match a canonical locale
2024-09-09 14:25:49 +01:00
3fde6bd730 I18n: Add constants value tests to avoid typos (#93070) 2024-09-09 15:49:47 +03:00
a89435aeab I18n: Require Trans i18nKey prop (#91399)
* I18n: Require Trans i18nKey prop

* fix lint errors
2024-08-02 10:46:27 +01:00
03311f6c6c I18n: Memoize formatDate/formatDuration methods because they're prett… (#90338)
I18n: Memoize formatDate/formatDuration methods because they're pretty slow!!
2024-07-12 10:38:47 +01:00
47f8717149 React: Use new JSX transform (#88802)
* update eslint, tsconfig + esbuild to handle new jsx transform

* remove thing that breaks the new jsx transform

* remove react imports

* adjust grafana-icons build

* is this the correct syntax?

* try this

* well this was much easier than expected...

* change grafana-plugin-configs webpack config

* fixes

* fix lockfile

* fix 2 more violations

* use path.resolve instead of require.resolve

* remove react import

* fix react imports

* more fixes

* remove React import

* remove import React from docs

* remove another react import
2024-06-25 12:43:47 +01:00
db78604bd4 I18n: Add utility for locale-aware duration formatting (#89351)
* I18n: Add utility for locale-aware duration formatting

* fix message

* add fallback
2024-06-19 10:37:20 +01:00
b0c043de5f Fix: Portuguese Brazilian wasn't loading translations (#89302) 2024-06-18 18:06:35 +01:00
fe24404432 I18n: Support for Enterprise translations (#86215)
* I18n: Support for Enterprise translations

* don't attempt to link to enterprise in tests

* move extract script to makefile to optionally support enterprise

* update references to old extract script

* update docs

* thank god for unit tests
2024-04-18 16:25:27 +01:00
0a12ad0084 I18n: Update English phrases that have changed in code, but not extracted (#86429)
Update English phrases that have changed in code, but not extracted
2024-04-17 14:47:01 +02:00
f90e3b2ebc I18N: Warn if t() called before init (#86222)
* I18N: Warn if t() called before init

* don't log in tests

* fix double assignemnt!
2024-04-16 12:47:24 +02:00
f110c05797 I18N: Split loadTranslations i18next plugin into seperate file (#86217) 2024-04-16 09:53:23 +01:00
b525de07cd I18n: Add Brazilian Portuguese (#84461)
* Add pt-br as supported language

* docs

* update pt-br path:

* docs
2024-03-21 13:51:30 +02:00
ed3bdf5502 I18n: Expose current UI language in @grafana/runtime config (#84457)
* I18n: Expose current UI language in Grafana config

* fix
2024-03-18 11:00:43 +00:00
313c43749c Explore: Fix incorrect interpolation of table title (#80227) 2024-01-16 12:22:32 +01:00
0d390382d3 I18n: Reset back to default plural seperators (#76284)
* reset to standard plural seperators for crowdin compatibility

* update docs
2023-10-10 19:00:33 +03:00
5654359813 I18n: Add server config to detect browser language (#69396)
* I18N: Add browser language detector

* Improve style

* No new property for type check

* Add dependency

* Suggested doc change

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Fix prettier

* 'detect' as special language, no cache and only navigator detector

As per PR suggestion comments

* Update language configuration doc

* Suggested change in doc

From @chri2547

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>

* Fix import

* Revert public/app/types/explore.ts changes

* Prettier write

---------

Co-authored-by: Christopher Moyer <35463610+chri2547@users.noreply.github.com>
Co-authored-by: joshhunt <josh@trtr.co>
2023-07-14 10:24:50 +00:00
2650aa5600 Internationalization: Correctly generate plural forms (#71341)
* user essentials mob! 🔱

lastFile:public/locales/pseudo-LOCALE/grafana.json

* user essentials mob! 🔱

* user essentials mob! 🔱

lastFile:contribute/internationalization.md

* user essentials mob! 🔱

lastFile:contribute/internationalization.md

* move pseudo generation to precommit hook if en-US file is modified

Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>

* fix unit tests

---------

Co-authored-by: Joao Silva <joao.silva@grafana.com>
Co-authored-by: joshhunt <josh@trtr.co>
Co-authored-by: Roxana Turc <anamaria-roxana.turc@grafana.com>
Co-authored-by: eledobleefe <laura.fernandez@grafana.com>
Co-authored-by: L-M-K-B <48948963+L-M-K-B@users.noreply.github.com>
Co-authored-by: tskarhed <1438972+tskarhed@users.noreply.github.com>
2023-07-11 16:37:01 +01:00
504eabbe80 Navigation: Ensure command palette is correctly translated (#61103)
* Navigation: Translate nav tree in store

* Remove usage of getNavTitle

* properly translate children

* add pubdash translation

* remove extraneous calls to translation in PageHeader

* empty commit

* correctly allow subtitle to be overrwitten (thank you tests!)

---------

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2023-02-08 13:15:37 +00:00
a26d4c90b2 I18N: Fail i18n:extract on warnings + update strings (#60949)
* I18N: Fail i18n:extract on warnings

* I18N: Fix onboarding page title

* extract all strings

* move t reassign outside of function
2023-01-04 15:28:07 +00:00
460be70261 Internationalization: Change locale preference to language (#58359)
* backend locale -> language

* frontend locale -> language

* sample.ini and tests

* fix few last locale -> language

* fix few last locale -> language
2022-11-22 12:18:34 +00:00
e417387bc7 I18n: Add German (#57397) 2022-10-21 11:47:17 +01:00
fc75076b72 I18n: Show languages in local names (#57367)
* I18n: Show languages in local names

* fixed test
2022-10-21 05:29:03 -04:00
8e512de308 I18n: update contributing docs (#56860)
* update contrib i18n docs

* update contrib i18n docs

* remove lingui references, rearrage plain js usage
2022-10-14 11:55:15 +01:00
b7d969baf1 I18n: Improve tooling (#56731)
* Delete en-US.json before extracting strings so it's always up to date

* Add 'comment' to message jsons

* Enable Pseudo-locale option only in dev mode

* don't load english messages

* fix package.json

* fix
2022-10-12 07:51:16 -04:00
719769ee7c I18n: Add Chinese (Simplified) (#56739)
* Prevent _old.json files from being created

* Add contrib docs for adding new locale

* add chinese (simplified)
2022-10-12 06:12:46 -04:00
6969354490 Chore: remove i18n console log (#56691) 2022-10-11 07:22:48 -04:00
891f9c00a1 I18n: Add lint rule to enforce correct i18n imports (#56487)
* I18n: Add lint rule to enforce correct i18n imports

* ignore in gui wrapper
2022-10-07 11:46:28 +01:00
5361efc225 I18n: Migrate to I18next (#55845)
* Switch from lingui from i18next

* Change lingui messages to i18next messages

* Change lingui messages to i18next messages (grafana-ui)

* Init i18n for tests
2022-10-06 16:34:04 +01:00