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} />; 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>) => { export const t = (id: string, defaultMessage: string, values?: Record<string, unknown>) => {
initI18n(); 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} />; 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>) => { 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 => { 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!')} title={t('datasource-onboarding.welcome', 'Welcome to Grafana dashboards!')}
CTAText={t('datasource-onboarding.sampleData', 'Or set up a new dashboard with sample data')} CTAText={t('datasource-onboarding.sampleData', 'Or set up a new dashboard with sample data')}
navId="dashboards/browse" 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" "unmark-favorite": "Markierung als Favorit entfernen"
} }
}, },
"datasource-onboarding": {
"contact-admin": "",
"explanation": "",
"logo": "",
"new-dashboard": "",
"preferred": "",
"sampleData": "",
"viewAll": "",
"welcome": ""
},
"folder-picker": { "folder-picker": {
"loading": "Ordner werden geladen …" "loading": "Ordner werden geladen …"
}, },
@ -131,6 +141,9 @@
"subtitle": "Zeige gruppierte Warnungen vom Alertmanager an", "subtitle": "Zeige gruppierte Warnungen vom Alertmanager an",
"title": "Gruppen" "title": "Gruppen"
}, },
"alerting-home": {
"title": ""
},
"alerting-legacy": { "alerting-legacy": {
"title": "Warnungen (Legacy)" "title": "Warnungen (Legacy)"
}, },
@ -208,6 +221,7 @@
"help/documentation": "Dokumentation", "help/documentation": "Dokumentation",
"help/keyboard-shortcuts": "Tastaturbefehle", "help/keyboard-shortcuts": "Tastaturbefehle",
"help/support": "Support", "help/support": "Support",
"help/support-bundle": "",
"home": { "home": {
"title": "Home" "title": "Home"
}, },
@ -298,6 +312,10 @@
"subtitle": "Dateispeicher verwalten", "subtitle": "Dateispeicher verwalten",
"title": "Speicher" "title": "Speicher"
}, },
"support-bundles": {
"subtitle": "",
"title": ""
},
"teams": { "teams": {
"subtitle": "Gruppen von Benutzern mit gemeinsamen Dashboards und Benachrichtigungen", "subtitle": "Gruppen von Benutzern mit gemeinsamen Dashboards und Benachrichtigungen",
"title": "Teams" "title": "Teams"

View File

@ -80,6 +80,16 @@
"unmark-favorite": "Unmark as favorite" "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": { "folder-picker": {
"loading": "Loading folders..." "loading": "Loading folders..."
}, },
@ -131,6 +141,9 @@
"subtitle": "See grouped alerts from an Alertmanager instance", "subtitle": "See grouped alerts from an Alertmanager instance",
"title": "Groups" "title": "Groups"
}, },
"alerting-home": {
"title": "Home"
},
"alerting-legacy": { "alerting-legacy": {
"title": "Alerting (legacy)" "title": "Alerting (legacy)"
}, },
@ -208,6 +221,7 @@
"help/documentation": "Documentation", "help/documentation": "Documentation",
"help/keyboard-shortcuts": "Keyboard shortcuts", "help/keyboard-shortcuts": "Keyboard shortcuts",
"help/support": "Support", "help/support": "Support",
"help/support-bundle": "Support Bundles",
"home": { "home": {
"title": "Home" "title": "Home"
}, },
@ -298,6 +312,10 @@
"subtitle": "Manage file storage", "subtitle": "Manage file storage",
"title": "Storage" "title": "Storage"
}, },
"support-bundles": {
"subtitle": "Download support bundles",
"title": "Support Bundles"
},
"teams": { "teams": {
"subtitle": "Groups of users that have common dashboard and permission needs", "subtitle": "Groups of users that have common dashboard and permission needs",
"title": "Teams" "title": "Teams"

View File

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

View File

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

View File

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

View File

@ -80,6 +80,16 @@
"unmark-favorite": "Ůʼnmäřĸ äş ƒävőřįŧę" "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": { "folder-picker": {
"loading": "Ŀőäđįʼnģ ƒőľđęřş..." "loading": "Ŀőäđįʼnģ ƒőľđęřş..."
}, },
@ -131,6 +141,9 @@
"subtitle": "Ŝęę ģřőūpęđ äľęřŧş ƒřőm äʼn Åľęřŧmäʼnäģęř įʼnşŧäʼnčę", "subtitle": "Ŝęę ģřőūpęđ äľęřŧş ƒřőm äʼn Åľęřŧmäʼnäģęř įʼnşŧäʼnčę",
"title": "Ğřőūpş" "title": "Ğřőūpş"
}, },
"alerting-home": {
"title": "Ħőmę"
},
"alerting-legacy": { "alerting-legacy": {
"title": "Åľęřŧįʼnģ (ľęģäčy)" "title": "Åľęřŧįʼnģ (ľęģäčy)"
}, },
@ -208,6 +221,7 @@
"help/documentation": "Đőčūmęʼnŧäŧįőʼn", "help/documentation": "Đőčūmęʼnŧäŧįőʼn",
"help/keyboard-shortcuts": "Ķęyþőäřđ şĥőřŧčūŧş", "help/keyboard-shortcuts": "Ķęyþőäřđ şĥőřŧčūŧş",
"help/support": "Ŝūppőřŧ", "help/support": "Ŝūppőřŧ",
"help/support-bundle": "Ŝūppőřŧ ßūʼnđľęş",
"home": { "home": {
"title": "Ħőmę" "title": "Ħőmę"
}, },
@ -298,6 +312,10 @@
"subtitle": "Mäʼnäģę ƒįľę şŧőřäģę", "subtitle": "Mäʼnäģę ƒįľę şŧőřäģę",
"title": "Ŝŧőřäģę" "title": "Ŝŧőřäģę"
}, },
"support-bundles": {
"subtitle": "Đőŵʼnľőäđ şūppőřŧ þūʼnđľęş",
"title": "Ŝūppőřŧ ßūʼnđľęş"
},
"teams": { "teams": {
"subtitle": "Ğřőūpş őƒ ūşęřş ŧĥäŧ ĥävę čőmmőʼn đäşĥþőäřđ äʼnđ pęřmįşşįőʼn ʼnęęđş", "subtitle": "Ğřőūpş őƒ ūşęřş ŧĥäŧ ĥävę čőmmőʼn đäşĥþőäřđ äʼnđ pęřmįşşįőʼn ʼnęęđş",
"title": "Ŧęämş" "title": "Ŧęämş"

View File

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