From 5cb038772bda52fd90911271b97093e91479bf17 Mon Sep 17 00:00:00 2001 From: Silje Christensen Date: Thu, 3 Aug 2023 14:16:16 +0200 Subject: [PATCH] feat: add internationalization (i18n) --- .../breadcrumbs/locales/en/messages.mjs | 1 + components/breadcrumbs/locales/en/messages.po | 20 + .../breadcrumbs/locales/nb/messages.mjs | 1 + components/breadcrumbs/locales/nb/messages.po | 20 + components/breadcrumbs/w-breadcrumbs.vue | 10 +- components/button/locales/en/messages.mjs | 1 + components/button/locales/en/messages.po | 20 + components/button/locales/nb/messages.mjs | 1 + components/button/locales/nb/messages.po | 20 + components/button/w-button.vue | 15 +- components/forms/locales/en/messages.mjs | 1 + components/forms/locales/en/messages.po | 26 + components/forms/locales/nb/messages.mjs | 1 + components/forms/locales/nb/messages.po | 26 + components/forms/w-affix.vue | 9 +- components/forms/w-field.vue | 9 +- components/modal/locales/en/messages.mjs | 1 + components/modal/locales/en/messages.po | 14 + components/modal/locales/nb/messages.mjs | 1 + components/modal/locales/nb/messages.po | 14 + components/pill/locales/en/messages.mjs | 1 + components/pill/locales/en/messages.po | 14 + components/pill/locales/nb/messages.mjs | 1 + components/pill/locales/nb/messages.po | 14 + components/util/i18n.ts | 29 + dev/pages/TextField.vue | 6 + lingui.config.ts | 33 + package.json | 9 +- pnpm-lock.yaml | 867 +++++++++++++++++- 29 files changed, 1141 insertions(+), 44 deletions(-) create mode 100644 components/breadcrumbs/locales/en/messages.mjs create mode 100644 components/breadcrumbs/locales/en/messages.po create mode 100644 components/breadcrumbs/locales/nb/messages.mjs create mode 100644 components/breadcrumbs/locales/nb/messages.po create mode 100644 components/button/locales/en/messages.mjs create mode 100644 components/button/locales/en/messages.po create mode 100644 components/button/locales/nb/messages.mjs create mode 100644 components/button/locales/nb/messages.po create mode 100644 components/forms/locales/en/messages.mjs create mode 100644 components/forms/locales/en/messages.po create mode 100644 components/forms/locales/nb/messages.mjs create mode 100644 components/forms/locales/nb/messages.po create mode 100644 components/modal/locales/en/messages.mjs create mode 100644 components/modal/locales/en/messages.po create mode 100644 components/modal/locales/nb/messages.mjs create mode 100644 components/modal/locales/nb/messages.po create mode 100644 components/pill/locales/en/messages.mjs create mode 100644 components/pill/locales/en/messages.po create mode 100644 components/pill/locales/nb/messages.mjs create mode 100644 components/pill/locales/nb/messages.po create mode 100644 components/util/i18n.ts create mode 100644 lingui.config.ts diff --git a/components/breadcrumbs/locales/en/messages.mjs b/components/breadcrumbs/locales/en/messages.mjs new file mode 100644 index 00000000..464a6ec7 --- /dev/null +++ b/components/breadcrumbs/locales/en/messages.mjs @@ -0,0 +1 @@ +/*eslint-disable*/export const messages=JSON.parse("{\"breadcrumbs.ariaLabel\":\"You are here\"}"); \ No newline at end of file diff --git a/components/breadcrumbs/locales/en/messages.po b/components/breadcrumbs/locales/en/messages.po new file mode 100644 index 00000000..fc38f745 --- /dev/null +++ b/components/breadcrumbs/locales/en/messages.po @@ -0,0 +1,20 @@ +msgid "" +msgstr "" +"POT-Creation-Date: 2023-08-03 14:10+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: @lingui/cli\n" +"Language: en\n" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Plural-Forms: \n" + +#. Default screenreader message for the breadcrumb component +#. js-lingui-explicit-id +#: components/breadcrumbs/w-breadcrumbs.vue:9 +msgid "breadcrumbs.ariaLabel" +msgstr "You are here" diff --git a/components/breadcrumbs/locales/nb/messages.mjs b/components/breadcrumbs/locales/nb/messages.mjs new file mode 100644 index 00000000..e83beb43 --- /dev/null +++ b/components/breadcrumbs/locales/nb/messages.mjs @@ -0,0 +1 @@ +/*eslint-disable*/export const messages=JSON.parse("{\"breadcrumbs.ariaLabel\":\"Her er du\"}"); \ No newline at end of file diff --git a/components/breadcrumbs/locales/nb/messages.po b/components/breadcrumbs/locales/nb/messages.po new file mode 100644 index 00000000..82a9c513 --- /dev/null +++ b/components/breadcrumbs/locales/nb/messages.po @@ -0,0 +1,20 @@ +msgid "" +msgstr "" +"POT-Creation-Date: 2023-08-03 14:10+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: @lingui/cli\n" +"Language: nb\n" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Plural-Forms: \n" + +#. Default screenreader message for the breadcrumb component +#. js-lingui-explicit-id +#: components/breadcrumbs/w-breadcrumbs.vue:9 +msgid "breadcrumbs.ariaLabel" +msgstr "Her er du" diff --git a/components/breadcrumbs/w-breadcrumbs.vue b/components/breadcrumbs/w-breadcrumbs.vue index 61e98019..7c91abcb 100644 --- a/components/breadcrumbs/w-breadcrumbs.vue +++ b/components/breadcrumbs/w-breadcrumbs.vue @@ -13,9 +13,15 @@ import { h, Fragment } from 'vue' import { interleave } from '@warp-ds/core/breadcrumbs' import { breadcrumbs as ccBreadcrumbs } from "@warp-ds/css/component-classes" +import { i18n } from '@lingui/core'; const props = defineProps({ - ariaLabel: { type: String, default: 'Her er du' } + ariaLabel: { type: String, default: i18n._( + /*i18n*/ { + id: 'breadcrumbs.ariaLabel', + message: 'You are here', + comment: 'Default screenreader message for the breadcrumb component', + }) } }); const isFragment = vnode => vnode.type === Fragment @@ -37,4 +43,6 @@ const Breadcrumbify = (_, context) => { diff --git a/components/button/locales/en/messages.mjs b/components/button/locales/en/messages.mjs new file mode 100644 index 00000000..65232587 --- /dev/null +++ b/components/button/locales/en/messages.mjs @@ -0,0 +1 @@ +/*eslint-disable*/export const messages=JSON.parse("{\"button.aria.loading\":\"Loading...\"}"); \ No newline at end of file diff --git a/components/button/locales/en/messages.po b/components/button/locales/en/messages.po new file mode 100644 index 00000000..81bf1025 --- /dev/null +++ b/components/button/locales/en/messages.po @@ -0,0 +1,20 @@ +msgid "" +msgstr "" +"POT-Creation-Date: 2023-08-03 14:10+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: @lingui/cli\n" +"Language: en\n" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Plural-Forms: \n" + +#. Screenreader message for buttons that are loading +#. js-lingui-explicit-id +#: components/button/w-button.vue:30 +msgid "button.aria.loading" +msgstr "Loading..." diff --git a/components/button/locales/nb/messages.mjs b/components/button/locales/nb/messages.mjs new file mode 100644 index 00000000..4e70126a --- /dev/null +++ b/components/button/locales/nb/messages.mjs @@ -0,0 +1 @@ +/*eslint-disable*/export const messages=JSON.parse("{\"button.aria.loading\":\"Laster...\"}"); \ No newline at end of file diff --git a/components/button/locales/nb/messages.po b/components/button/locales/nb/messages.po new file mode 100644 index 00000000..ce10701d --- /dev/null +++ b/components/button/locales/nb/messages.po @@ -0,0 +1,20 @@ +msgid "" +msgstr "" +"POT-Creation-Date: 2023-08-03 14:10+0200\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=utf-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Generator: @lingui/cli\n" +"Language: nb\n" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: \n" +"Last-Translator: \n" +"Language-Team: \n" +"Plural-Forms: \n" + +#. Screenreader message for buttons that are loading +#. js-lingui-explicit-id +#: components/button/w-button.vue:30 +msgid "button.aria.loading" +msgstr "Laster..." diff --git a/components/button/w-button.vue b/components/button/w-button.vue index 56522828..3c773a76 100644 --- a/components/button/w-button.vue +++ b/components/button/w-button.vue @@ -1,17 +1,20 @@ diff --git a/components/forms/w-field.vue b/components/forms/w-field.vue index d53fdfc7..d27beeae 100644 --- a/components/forms/w-field.vue +++ b/components/forms/w-field.vue @@ -1,6 +1,6 @@