From 772f4982cb134564722c75431b2ee35c523976ec Mon Sep 17 00:00:00 2001 From: Patrik Oldsberg Date: Fri, 24 Nov 2023 13:47:15 +0100 Subject: [PATCH] docs: update internationalization to use camelCase and nested message declarations Signed-off-by: Patrik Oldsberg --- docs/plugins/internationalization.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/docs/plugins/internationalization.md b/docs/plugins/internationalization.md index 78b7de6342..13bb098262 100644 --- a/docs/plugins/internationalization.md +++ b/docs/plugins/internationalization.md @@ -10,7 +10,7 @@ The Backstage core function provides internationalization for plugins ## For a plugin developer -When you are creating your plugin, you have the possibility to use `createTranslationRef` to define all messages for your plugin. For example +When you are creating your plugin, you have the possibility to use `createTranslationRef` to define all messages for your plugin. For example: ```ts import { createTranslationRef } from '@backstage/core-plugin-api/alpha'; @@ -19,8 +19,13 @@ import { createTranslationRef } from '@backstage/core-plugin-api/alpha'; export const myPluginTranslationRef = createTranslationRef({ id: 'plugin.my-plugin', messages: { - index_page_title: 'All your components', - create_component_button_label: 'Create new component', + indexPage: { + title: 'All your components', + createButtonTitle: 'Create new component', + }, + entityPage: { + notFound: 'Entity not found', + }, }, }); ``` @@ -33,9 +38,9 @@ import { useTranslationRef } from '@backstage/core-plugin-api/alpha'; const { t } = useTranslationRef(myPluginTranslationRef); return ( - + ); @@ -53,7 +58,7 @@ In an app you can both override the default messages, as well as register transl + createTranslationMessages({ + ref: myPluginTranslationRef, + messages: { -+ create_component_button_label: 'Create new entity', ++ 'indexPage.createButtonTitle': 'Create new entity', + }, + }), + createTranslationResource({