Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/core/internationalization.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import i18next from 'i18next';
import LanguageDetector from 'i18next-browser-languagedetector';
import { default as fallbackResources, languages } from '../../translations';
import { VERSION } from './constants';

if (typeof IS_MINIFIED === 'undefined') {
// internationalization is only for the unminified build
Expand Down Expand Up @@ -147,8 +148,12 @@ export const initialize = () => {
},
backend: {
fallback: 'en',
loadPath:
'https://cdn.jsdelivr.net/npm/p5/translations/{{lng}}/{{ns}}.json'

// ensure that the FES internationalization strings are loaded
// from the latest patch of the current minor version of p5.js
loadPath: `https://cdn.jsdelivr.net/npm/p5@${
VERSION.replace(/^(\d+\.\d+)\.\d+.*$/, '$1')
}/translations/{{lng}}/{{ns}}.json`
},
partialBundledLanguages: true,
resources: fallbackResources
Expand Down
Loading