From 4ad63d75df46347c80ea1de6ae6a81e455485dd6 Mon Sep 17 00:00:00 2001 From: ksen0 Date: Wed, 4 Jun 2025 21:21:25 +0200 Subject: [PATCH 1/2] Use FES internationalization within the minor version --- src/core/internationalization.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/internationalization.js b/src/core/internationalization.js index e8e140c12c..1f1586c795 100644 --- a/src/core/internationalization.js +++ b/src/core/internationalization.js @@ -1,5 +1,7 @@ import i18next from 'i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; +import { version } from '../../package.json'; + let fallbackResources, languages; if (typeof IS_MINIFIED === 'undefined') { @@ -127,6 +129,7 @@ export let translator = (key, values) => { * Set up our translation function, with loaded languages */ export const initialize = () => { + let latestMinorVersionPath = 'https://cdn.jsdelivr.net/npm/p5@' + version.replace(/^(\d+\.\d+)\.\d+.*$/, '$1'); let i18init = i18next .use(LanguageDetector) .use(FetchResources) @@ -149,8 +152,7 @@ export const initialize = () => { }, backend: { fallback: 'en', - loadPath: - 'https://cdn.jsdelivr.net/npm/p5/translations/{{lng}}/{{ns}}.json' + loadPath: latestMinorVersionPath + '/translations/{{lng}}/{{ns}}.json' }, partialBundledLanguages: true, resources: fallbackResources From 3887266a8afb9288054f583ce8552fa5719531a3 Mon Sep 17 00:00:00 2001 From: ksen0 Date: Tue, 10 Jun 2025 12:05:12 +0200 Subject: [PATCH 2/2] User constants.VERSION for version-aware FES localisation --- src/core/internationalization.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/internationalization.js b/src/core/internationalization.js index 1f1586c795..eeea554541 100644 --- a/src/core/internationalization.js +++ b/src/core/internationalization.js @@ -1,6 +1,6 @@ import i18next from 'i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; -import { version } from '../../package.json'; +import * as constants from './constants'; let fallbackResources, languages; @@ -129,7 +129,7 @@ export let translator = (key, values) => { * Set up our translation function, with loaded languages */ export const initialize = () => { - let latestMinorVersionPath = 'https://cdn.jsdelivr.net/npm/p5@' + version.replace(/^(\d+\.\d+)\.\d+.*$/, '$1'); + let latestMinorVersionPath = 'https://cdn.jsdelivr.net/npm/p5@' + constants.VERSION.replace(/^(\d+\.\d+)\.\d+.*$/, '$1'); let i18init = i18next .use(LanguageDetector) .use(FetchResources)