From 0e53244469d8a9bef865d5cf07d75aa47ddb7edc Mon Sep 17 00:00:00 2001 From: sebastian-raubach Date: Wed, 27 Sep 2023 16:48:16 +0100 Subject: [PATCH] - ADD: Initial support for RTL languages. - ADD: Added support for non-latin numbers. - CHG: Changed locale encoding from using "_" to "-" to be easier to use with Intl etc. --- src/App.vue | 14 ++----- src/components/TraitInputSection.vue | 4 +- src/components/TrialSelector.vue | 2 +- src/components/canvas/ColumnHeader.vue | 2 +- src/components/canvas/PlotCanvas.vue | 6 ++- src/components/canvas/RowHeader.vue | 2 +- src/components/charts/FieldHeatmap.vue | 4 +- src/components/charts/GermplasmRepHeatmap.vue | 4 +- src/components/dropdowns/JumpToDropdown.vue | 2 + src/components/modals/DataInputModal.vue | 4 +- src/plugins/i18n.js | 41 ++++++++++++++----- src/plugins/i18n/ar_MA.json | 2 + src/plugins/misc.js | 2 +- src/store/index.js | 6 +-- src/views/SettingsView.vue | 2 +- 15 files changed, 59 insertions(+), 38 deletions(-) create mode 100644 src/plugins/i18n/ar_MA.json diff --git a/src/App.vue b/src/App.vue index b59f05c..b3d3893 100644 --- a/src/App.vue +++ b/src/App.vue @@ -84,7 +84,7 @@ import BrapiModal from '@/components/modals/BrapiModal' import ChangelogModal from '@/components/modals/ChangelogModal' import MissingTrialModal from '@/components/modals/MissingTrialModal' import { mapGetters } from 'vuex' -import { loadLanguageAsync } from '@/plugins/i18n' +import { loadLanguageAsync, locales } from '@/plugins/i18n' import { init } from '@/plugins/datastore' import { VuePlausible } from 'vue-plausible' import Vue from 'vue' @@ -121,15 +121,7 @@ export default { }, data: function () { return { - languages: [{ - locale: 'en_GB', - name: 'British English', - icon: '🇬🇧' - }, { - locale: 'de_DE', - name: 'Deutsch - Deutschland', - icon: '🇩🇪' - }], + languages: locales, loadingVisible: false, refreshing: false, registration: null, @@ -276,7 +268,7 @@ export default { initDb() }, mounted: function () { - loadLanguageAsync(this.storeLocale) + loadLanguageAsync(this.storeLocale.replace('_', '-')) document.documentElement.className = this.storeDarkMode ? 'dark-mode' : 'light-mode' diff --git a/src/components/TraitInputSection.vue b/src/components/TraitInputSection.vue index 7e22cb1..5aba9af 100644 --- a/src/components/TraitInputSection.vue +++ b/src/components/TraitInputSection.vue @@ -18,7 +18,7 @@ - {{ trait.setSize || 1 }} + {{ $n(trait.setSize || 1) }} @@ -35,7 +35,7 @@

{{ trait.description }}

- diff --git a/src/components/TrialSelector.vue b/src/components/TrialSelector.vue index ec6e3a1..0d24233 100644 --- a/src/components/TrialSelector.vue +++ b/src/components/TrialSelector.vue @@ -21,7 +21,7 @@ - +