Skip to content

Commit 468b79d

Browse files
committed
Use FES internationalization within the minor version
1 parent ca9d475 commit 468b79d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/core/internationalization.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import i18next from 'i18next';
22
import LanguageDetector from 'i18next-browser-languagedetector';
33
import { default as fallbackResources, languages } from '../../translations';
4+
import { VERSION } from './constants';
45

56
if (typeof IS_MINIFIED === 'undefined') {
67
// internationalization is only for the unminified build
@@ -147,8 +148,12 @@ export const initialize = () => {
147148
},
148149
backend: {
149150
fallback: 'en',
150-
loadPath:
151-
'https://cdn.jsdelivr.net/npm/p5/translations/{{lng}}/{{ns}}.json'
151+
152+
// ensure that the FES internationalization strings are loaded
153+
// from the latest patch of the current minor version of p5.js
154+
loadPath: `https://cdn.jsdelivr.net/npm/p5@${
155+
VERSION.replace(/^(\d+\.\d+)\.\d+.*$/, '$1')
156+
}/translations/{{lng}}/{{ns}}.json`
152157
},
153158
partialBundledLanguages: true,
154159
resources: fallbackResources

0 commit comments

Comments
 (0)