Skip to content

Commit 4ad63d7

Browse files
committed
Use FES internationalization within the minor version
1 parent 53a3965 commit 4ad63d7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/internationalization.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import i18next from 'i18next';
22
import LanguageDetector from 'i18next-browser-languagedetector';
3+
import { version } from '../../package.json';
4+
35

46
let fallbackResources, languages;
57
if (typeof IS_MINIFIED === 'undefined') {
@@ -127,6 +129,7 @@ export let translator = (key, values) => {
127129
* Set up our translation function, with loaded languages
128130
*/
129131
export const initialize = () => {
132+
let latestMinorVersionPath = 'https://cdn.jsdelivr.net/npm/p5@' + version.replace(/^(\d+\.\d+)\.\d+.*$/, '$1');
130133
let i18init = i18next
131134
.use(LanguageDetector)
132135
.use(FetchResources)
@@ -149,8 +152,7 @@ export const initialize = () => {
149152
},
150153
backend: {
151154
fallback: 'en',
152-
loadPath:
153-
'https://cdn.jsdelivr.net/npm/p5/translations/{{lng}}/{{ns}}.json'
155+
loadPath: latestMinorVersionPath + '/translations/{{lng}}/{{ns}}.json'
154156
},
155157
partialBundledLanguages: true,
156158
resources: fallbackResources

0 commit comments

Comments
 (0)