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
This commit is contained in:
Josh Hunt
2023-01-04 15:28:07 +00:00
committed by GitHub
parent d572ccdb2a
commit a26d4c90b2
10 changed files with 122 additions and 3 deletions

View File

@ -28,7 +28,11 @@ export const Trans: typeof I18NextTrans = (props) => {
return <I18NextTrans {...props} />;
};
// Reassign t() so i18next-parser doesn't warn on dynamic key, and we can have 'failOnWarnings' enabled
const tFunc = i18next.t;
export const t = (id: string, defaultMessage: string, values?: Record<string, unknown>) => {
initI18n();
return i18next.t(id, defaultMessage, values);
return tFunc(id, defaultMessage, values);
};

View File

@ -55,8 +55,11 @@ export const Trans: typeof I18NextTrans = (props) => {
return <I18NextTrans {...props} />;
};
// Reassign t() so i18next-parser doesn't warn on dynamic key, and we can have 'failOnWarnings' enabled
const tFunc = i18n.t;
export const t = (id: string, defaultMessage: string, values?: Record<string, unknown>) => {
return i18n.t(id, defaultMessage, values);
return tFunc(id, defaultMessage, values);
};
export const i18nDate = (value: number | Date | string, format: Intl.DateTimeFormatOptions = {}): string => {

View File

@ -32,7 +32,7 @@ export default function NewDashboardPage(props: GrafanaRouteComponentProps) {
title={t('datasource-onboarding.welcome', 'Welcome to Grafana dashboards!')}
CTAText={t('datasource-onboarding.sampleData', 'Or set up a new dashboard with sample data')}
navId="dashboards/browse"
pageNav={{ text: t('dashboard', 'New dashboard'), url: '/dashboard/new' }}
pageNav={{ text: t('datasource-onboarding.new-dashboard', 'New dashboard'), url: '/dashboard/new' }}
/>
);
}

View File

@ -80,6 +80,16 @@
"unmark-favorite": "Markierung als Favorit entfernen"
}
},
"datasource-onboarding": {
"contact-admin": "",
"explanation": "",
"logo": "",
"new-dashboard": "",
"preferred": "",
"sampleData": "",
"viewAll": "",
"welcome": ""
},
"folder-picker": {
"loading": "Ordner werden geladen …"
},
@ -131,6 +141,9 @@
"subtitle": "Zeige gruppierte Warnungen vom Alertmanager an",
"title": "Gruppen"
},
"alerting-home": {
"title": ""
},
"alerting-legacy": {
"title": "Warnungen (Legacy)"
},
@ -208,6 +221,7 @@
"help/documentation": "Dokumentation",
"help/keyboard-shortcuts": "Tastaturbefehle",
"help/support": "Support",
"help/support-bundle": "",
"home": {
"title": "Home"
},
@ -298,6 +312,10 @@
"subtitle": "Dateispeicher verwalten",
"title": "Speicher"
},
"support-bundles": {
"subtitle": "",
"title": ""
},
"teams": {
"subtitle": "Gruppen von Benutzern mit gemeinsamen Dashboards und Benachrichtigungen",
"title": "Teams"

View File

@ -80,6 +80,16 @@
"unmark-favorite": "Unmark as favorite"
}
},
"datasource-onboarding": {
"contact-admin": "Please contact your administrator to configure data sources.",
"explanation": "To visualize your data, you'll need to connect it first.",
"logo": "Logo for {{datasourceName}} data source",
"new-dashboard": "New dashboard",
"preferred": "Connect your preferred data source:",
"sampleData": "Or set up a new dashboard with sample data",
"viewAll": "View all",
"welcome": "Welcome to Grafana dashboards!"
},
"folder-picker": {
"loading": "Loading folders..."
},
@ -131,6 +141,9 @@
"subtitle": "See grouped alerts from an Alertmanager instance",
"title": "Groups"
},
"alerting-home": {
"title": "Home"
},
"alerting-legacy": {
"title": "Alerting (legacy)"
},
@ -208,6 +221,7 @@
"help/documentation": "Documentation",
"help/keyboard-shortcuts": "Keyboard shortcuts",
"help/support": "Support",
"help/support-bundle": "Support Bundles",
"home": {
"title": "Home"
},
@ -298,6 +312,10 @@
"subtitle": "Manage file storage",
"title": "Storage"
},
"support-bundles": {
"subtitle": "Download support bundles",
"title": "Support Bundles"
},
"teams": {
"subtitle": "Groups of users that have common dashboard and permission needs",
"title": "Teams"

View File

@ -80,6 +80,16 @@
"unmark-favorite": "Deshacer marca como favorito"
}
},
"datasource-onboarding": {
"contact-admin": "",
"explanation": "",
"logo": "",
"new-dashboard": "",
"preferred": "",
"sampleData": "",
"viewAll": "",
"welcome": ""
},
"folder-picker": {
"loading": "Cargando carpetas..."
},
@ -131,6 +141,9 @@
"subtitle": "Ver alertas agrupadas de una instancia de Alertmanager",
"title": "Grupos"
},
"alerting-home": {
"title": ""
},
"alerting-legacy": {
"title": "Alertas (heredado)"
},
@ -208,6 +221,7 @@
"help/documentation": "Documentación",
"help/keyboard-shortcuts": "Atajos de teclado",
"help/support": "Asistencia",
"help/support-bundle": "",
"home": {
"title": "Inicio"
},
@ -298,6 +312,10 @@
"subtitle": "Gestionar el almacenamiento de archivos",
"title": "Almacenamiento"
},
"support-bundles": {
"subtitle": "",
"title": ""
},
"teams": {
"subtitle": "Grupos de usuarios que tienen necesidades comunes de permisos y de panel de control",
"title": "Equipos"

View File

@ -80,6 +80,16 @@
"unmark-favorite": "Supprimer des favoris"
}
},
"datasource-onboarding": {
"contact-admin": "",
"explanation": "",
"logo": "",
"new-dashboard": "",
"preferred": "",
"sampleData": "",
"viewAll": "",
"welcome": ""
},
"folder-picker": {
"loading": "Chargement des dossiers..."
},
@ -131,6 +141,9 @@
"subtitle": "Consulter les alertes groupées d'une instance Alertmanager",
"title": "Groupes"
},
"alerting-home": {
"title": ""
},
"alerting-legacy": {
"title": "Alerte (existante)"
},
@ -208,6 +221,7 @@
"help/documentation": "Documentation",
"help/keyboard-shortcuts": "Raccourcis clavier",
"help/support": "Assistance",
"help/support-bundle": "",
"home": {
"title": "Accueil"
},
@ -298,6 +312,10 @@
"subtitle": "Gérer le stockage de fichiers",
"title": "Stockage"
},
"support-bundles": {
"subtitle": "",
"title": ""
},
"teams": {
"subtitle": "Groupes d'utilisateurs ayant des besoins communs en matière de tableau de bord et d'autorisations",
"title": "Équipes"

View File

@ -12,6 +12,10 @@ module.exports = {
createOldCatalogs: false,
failOnWarnings: true,
verbose: false,
// Don't include default values for English, they'll remain in the source code
skipDefaultValues: (locale) => locale !== 'en-US',
};

View File

@ -80,6 +80,16 @@
"unmark-favorite": "Ůʼnmäřĸ äş ƒävőřįŧę"
}
},
"datasource-onboarding": {
"contact-admin": "Pľęäşę čőʼnŧäčŧ yőūř äđmįʼnįşŧřäŧőř ŧő čőʼnƒįģūřę đäŧä şőūřčęş.",
"explanation": "Ŧő vįşūäľįžę yőūř đäŧä, yőū'ľľ ʼnęęđ ŧő čőʼnʼnęčŧ įŧ ƒįřşŧ.",
"logo": "Ŀőģő ƒőř {{datasourceName}} đäŧä şőūřčę",
"new-dashboard": "Ńęŵ đäşĥþőäřđ",
"preferred": "Cőʼnʼnęčŧ yőūř přęƒęřřęđ đäŧä şőūřčę:",
"sampleData": "Øř şęŧ ūp ä ʼnęŵ đäşĥþőäřđ ŵįŧĥ şämpľę đäŧä",
"viewAll": "Vįęŵ äľľ",
"welcome": "Ŵęľčőmę ŧő Ğřäƒäʼnä đäşĥþőäřđş!"
},
"folder-picker": {
"loading": "Ŀőäđįʼnģ ƒőľđęřş..."
},
@ -131,6 +141,9 @@
"subtitle": "Ŝęę ģřőūpęđ äľęřŧş ƒřőm äʼn Åľęřŧmäʼnäģęř įʼnşŧäʼnčę",
"title": "Ğřőūpş"
},
"alerting-home": {
"title": "Ħőmę"
},
"alerting-legacy": {
"title": "Åľęřŧįʼnģ (ľęģäčy)"
},
@ -208,6 +221,7 @@
"help/documentation": "Đőčūmęʼnŧäŧįőʼn",
"help/keyboard-shortcuts": "Ķęyþőäřđ şĥőřŧčūŧş",
"help/support": "Ŝūppőřŧ",
"help/support-bundle": "Ŝūppőřŧ ßūʼnđľęş",
"home": {
"title": "Ħőmę"
},
@ -298,6 +312,10 @@
"subtitle": "Mäʼnäģę ƒįľę şŧőřäģę",
"title": "Ŝŧőřäģę"
},
"support-bundles": {
"subtitle": "Đőŵʼnľőäđ şūppőřŧ þūʼnđľęş",
"title": "Ŝūppőřŧ ßūʼnđľęş"
},
"teams": {
"subtitle": "Ğřőūpş őƒ ūşęřş ŧĥäŧ ĥävę čőmmőʼn đäşĥþőäřđ äʼnđ pęřmįşşįőʼn ʼnęęđş",
"title": "Ŧęämş"

View File

@ -80,6 +80,16 @@
"unmark-favorite": "取消标记为收藏"
}
},
"datasource-onboarding": {
"contact-admin": "",
"explanation": "",
"logo": "",
"new-dashboard": "",
"preferred": "",
"sampleData": "",
"viewAll": "",
"welcome": ""
},
"folder-picker": {
"loading": "正在加载文件夹..."
},
@ -131,6 +141,9 @@
"subtitle": "查看来自 Alertmanager警报管理器实例的分组警报",
"title": "组"
},
"alerting-home": {
"title": ""
},
"alerting-legacy": {
"title": "警报(遗留)"
},
@ -208,6 +221,7 @@
"help/documentation": "文档",
"help/keyboard-shortcuts": "快捷键",
"help/support": "支持",
"help/support-bundle": "",
"home": {
"title": "首页"
},
@ -298,6 +312,10 @@
"subtitle": "管理文件存储",
"title": "存储"
},
"support-bundles": {
"subtitle": "",
"title": ""
},
"teams": {
"subtitle": "具有共同仪表板和权限需求的用户组",
"title": "团队"