Chore: Align on 'internationalization' for feature name (#52585)

* rename internationalization docs

* Move localisation.tsx to internationalization/index.tsx
This commit is contained in:
Josh Hunt 2022-07-21 11:31:08 +01:00 committed by GitHub
parent 3fbec39952
commit 62a3f2ed32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 9 deletions

View File

@ -17,7 +17,7 @@ vendor
# TS generate from cue by cuetsy
**/*.gen.ts
# Auto-generated localisation files
# Auto-generated internationalization files
public/locales/_build/
public/locales/**/*.js

2
.gitignore vendored
View File

@ -162,7 +162,7 @@ compilation-stats.json
!pkg/coremodel/**/*_gen.go
!pkg/framework/**/*_gen.go
# Auto-generated localisation files
# Auto-generated internationalization files
public/locales/_build/
public/locales/**/*.js

View File

@ -18,7 +18,7 @@ vendor
# TS generate from cue by cuetsy
**/*.gen.ts
# Auto-generated localisation files
# Auto-generated internationalization files
public/locales/_build/
public/locales/**/*.js

View File

@ -1,4 +1,4 @@
# Localisation
# Internationalization
Grafana uses the [LinguiJS](https://github.com/lingui/js-lingui) framework for managing translating phrases in the Grafana frontend.
@ -59,7 +59,7 @@ For components used all over the site, use just two segments:
### Top-level provider
In [AppWrapper.tsx](/public/app/AppWrapper.tsx) the app is wrapped with `I18nProvider` from `public/app/core/localisation.tsx` where the Lingui instance is created with the user's preferred locale. This sets the appropriate context and allows any component from `@lingui/macro` to use the translations for the user's preferred locale.
In [AppWrapper.tsx](/public/app/AppWrapper.tsx) the app is wrapped with `I18nProvider` from `public/app/core/internationalization/index.tsx` where the Lingui instance is created with the user's preferred locale. This sets the appropriate context and allows any component from `@lingui/macro` to use the translations for the user's preferred locale.
### Message format

View File

@ -15,7 +15,7 @@ import { GrafanaApp } from './app';
import { AppChrome } from './core/components/AppChrome/AppChrome';
import { AppNotificationList } from './core/components/AppNotifications/AppNotificationList';
import { NavBar } from './core/components/NavBar/NavBar';
import { I18nProvider } from './core/localisation';
import { I18nProvider } from './core/internationalization';
import { GrafanaRoute } from './core/navigation/GrafanaRoute';
import { RouteDescriptor } from './core/navigation/types';
import { contextSrv } from './core/services/context_srv';

View File

@ -4,7 +4,7 @@ import React, { useEffect } from 'react';
import config from 'app/core/config';
import { messages } from '../../locales/en/messages';
import { messages } from '../../../locales/en/messages';
let i18nInstance: I18n;
@ -15,7 +15,7 @@ export async function getI18n(locale = 'en') {
// Dynamically load the messages for the user's locale
const imp =
config.featureToggles.internationalization &&
(await import(`../../locales/${locale}/messages`).catch((err) => {
(await import(`../../../locales/${locale}/messages`).catch((err) => {
// TODO: Properly return an error if we can't find the messages for a locale
return err;
}));

View File

@ -1,6 +1,6 @@
import React from 'react';
import { I18nProvider } from '../../app/core/localisation';
import { I18nProvider } from '../../app/core/internationalization';
const TestProvider: React.FC = ({ children }) => {
return <I18nProvider>{children}</I18nProvider>;