Conversation
| @@ -1,4 +1,4 @@ | |||
| { | |||
| "version": "6.7.8", | |||
| "version": "6.8.4", | |||
There was a problem hiding this comment.
auto updated when running npx @grafana/create-plugin@latest update
| @@ -75,4 +75,152 @@ We use the file nesting feature to help manage the growing number of files in th | |||
| } | |||
| ``` | |||
|
|
|||
There was a problem hiding this comment.
Is this the best place to put this documentation?
There was a problem hiding this comment.
I think that's a good location for it.
Just a heads up that the developer-facing stuff here is solid and will stick around (how to use t()/Trans, key naming, best practices). But the workflow sections (extraction, adding languages, file structure) will probably need a rewrite once we get Crowdin set up in Phase 2.
VikaCep
left a comment
There was a problem hiding this comment.
😻 YAY! Love this work.
A few comments on the translations.
I see this branches off chore/migrate-react-router-v6 as you mentioned. I think that's good as we should merge it soon. But I'm wondering if that is purely because @grafana/i18n with initPluginTranslations requires the Grafana 12.2+ packages that come with that upgrade, or is there a direct dependency I'm missing?
| @@ -0,0 +1,41 @@ | |||
| { | |||
| "addNewCheckButton": { | |||
| "createNewCheck": "Crear nuevo cheque" | |||
There was a problem hiding this comment.
| "createNewCheck": "Crear nuevo cheque" | |
| "createNewCheck": "Crear nueva prueba" |
I think "prueba" sounds more natural than "chequeo".
Cheque on the other hand refers to the one from the bank 😄
| "checkFilters": { | ||
| "alerts": "Alertas", | ||
| "all": "Todos", | ||
| "allProbes": "Todas las sondas", |
There was a problem hiding this comment.
| "allProbes": "Todas las sondas", | |
| "allProbes": "Todos los agentes", |
I'd use "agentes" directly. Otherwise "ubicaciones" could work as well.
| "filterByAlertsAriaLabel": "Filtrar por alertas", | ||
| "filterByStatusAriaLabel": "Filtrar por estado", | ||
| "filterByTypeAriaLabel": "Filtrar por tipo", | ||
| "probes": "Sondas", |
There was a problem hiding this comment.
| "probes": "Sondas", | |
| "probes": "Agentes", |
| "filterByStatusAriaLabel": "Filtrar por estado", | ||
| "filterByTypeAriaLabel": "Filtrar por tipo", | ||
| "probes": "Sondas", | ||
| "searchChecksAriaLabel": "Buscar chequeos", |
There was a problem hiding this comment.
| "searchChecksAriaLabel": "Buscar chequeos", | |
| "searchChecksAriaLabel": "Buscar pruebas", |
| "filterByTypeAriaLabel": "Filtrar por tipo", | ||
| "probes": "Sondas", | ||
| "searchChecksAriaLabel": "Buscar chequeos", | ||
| "searchPlaceholder": "Buscar por nombre de trabajo, punto final o etiqueta", |
There was a problem hiding this comment.
| "searchPlaceholder": "Buscar por nombre de trabajo, punto final o etiqueta", | |
| "searchPlaceholder": "Buscar por nombre del job, endpoint o etiqueta", |
I'd keep the technical terms as they are, since they don't translate well.
| "selectAllAriaLabel": "Seleccionar todos", | ||
| "setThresholds": "Establecer umbrales", | ||
| "sortOptions": { | ||
| "ascExecutions": "Ejecuciones asc. ", |
There was a problem hiding this comment.
| "ascExecutions": "Ejecuciones asc. ", | |
| "ascExecutions": "Ejecuciones asc.", |
| "setThresholds": "Establecer umbrales", | ||
| "sortOptions": { | ||
| "ascExecutions": "Ejecuciones asc. ", | ||
| "ascReachability": "Accesibilidad asc. ", |
There was a problem hiding this comment.
| "ascReachability": "Accesibilidad asc. ", | |
| "ascReachability": "Accesibilidad asc.", |
| "sortOptions": { | ||
| "ascExecutions": "Ejecuciones asc. ", | ||
| "ascReachability": "Accesibilidad asc. ", | ||
| "descExecutions": "Ejecuciones desc. ", |
There was a problem hiding this comment.
| "descExecutions": "Ejecuciones desc. ", | |
| "descExecutions": "Ejecuciones desc.", |
| "ascExecutions": "Ejecuciones asc. ", | ||
| "ascReachability": "Accesibilidad asc. ", | ||
| "descExecutions": "Ejecuciones desc. ", | ||
| "descReachability": "Accesibilidad desc. " |
There was a problem hiding this comment.
| "descReachability": "Accesibilidad desc. " | |
| "descReachability": "Accesibilidad desc." |
src/module.tsx
Outdated
|
|
||
| import { ProvisioningJsonData } from './types'; | ||
|
|
||
| await initPluginTranslations(pluginJson.id); |
There was a problem hiding this comment.
If we add this here, then I believe we can remove it from https://github.com/grafana/synthetic-monitoring-app/blob/feat/add-i18n-support/src/components/ScenesProvider.tsx#L7
There was a problem hiding this comment.
Having it in module.tsx produces a a +281.38% increase according to Danger.js.
The bundle size increase is because it imports whole package to the main bundle that Grafana loads upfront.
We could avoid this by initialising translations inside the lazy() loaders instead, so it loads alongside the app code on demand rather than upfront.
ckbedwell
left a comment
There was a problem hiding this comment.
Looking good! What's the plan for when we say this PR is ready to go in?
I just looked at the parent issue and I think a missing piece is updating our CI/CD workflow to integrate this. At the moment it seems easy to add a new translation key but forget to run the i18n extract script. Do we have plans to address that?
1959d39 to
e561d6b
Compare
Script size changes
Totals
|
@ckbedwell Added a workflow to the CI to validate, and fails if they forgot to extract |
3a9888a to
44a4b84
Compare
@VikaCep |
VikaCep
left a comment
There was a problem hiding this comment.
👏 👏 👏 t('pr.approved', 'Great work!')
ckbedwell
left a comment
There was a problem hiding this comment.
Teeny tiny nit. I'm approving anyway so take that as feel free to merge when you are ready.
I have wanted this for AGES so I am super chuffed that you got on top of it so swiftly. Great job! 👏 ❤️
| value={isAllSelected} | ||
| disabled={checks.length === 0} | ||
| aria-label="Select all" | ||
| aria-label={t('checkList.header.selectAllAriaLabel', 'Select all')} |
There was a problem hiding this comment.
As this matches what is on line 82 we should use the same key. We should document that we will default to brevity for shared strings and then if they need to be split up at a later date we will add it.
I know the Grafana team had a conversation about how to handle shared strings which are repeatedly used throughout their codebase but I don't know what conclusions they arrived at and what their key naming conventions for those are. Could be worth looking up?
Not for this PR (if ever... juice / squeeze matrix ) but I wonder if there is a solution where for common strings we can use Grafana's translation files rather than us duplicating them, too?
There was a problem hiding this comment.
Good question! I couldn't find anything on slack or google docs relating to this, so I started a thread
There was a problem hiding this comment.
Seems like the sentiment is to use separate keys, since the two “Select all” strings have different use cases — one is tooltip content and the other is an aria-label
Another argument we could make is that the same word in English can have different meanings, and may need different translations depending on context and location
With that in mind, if we were to put common strings in a centralized translation file though, we’d need to be explicit about the context and intended use for each string
- Upgrade react-router-dom from v5 to v6.27.0 - Remove react-router-dom-v5-compat dependency - Update React to 18.3.0 and Grafana packages to 12.2.0 - Migrate route imports and navigation to v6 APIs - Use locationService for programmatic navigation - Update webpack externals configuration
Initialize @grafana/i18n before rendering scenes components. Workaround for grafana/scenes#1322
…init behind lazy load
This reverts commit 7c57723.
a07917e to
8945144
Compare
|
@VikaCep @ckbedwell had to re-request your reviews for rebasing 😅 |


What this PR does / why we need it
We want to add i18n support to the SM plugin. This PR sets up i18n for contribution, and adds some translations as a proof of concept
Which issue(s) this PR fixes
Implements Phase 1 of #1556