@energie360/ui-library 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/globals.js
CHANGED
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
// TODO: Find a more 'generic' way to set an environment variable when using/developing the library.
|
|
7
7
|
// In the meantime we'll just use this fixed path for the ui-assets.
|
|
8
8
|
|
|
9
|
-
const assetsPathPrefix = import.meta.env.VITE_ASSETS_PATH_PREFIX || ''
|
|
9
|
+
const assetsPathPrefix = import.meta?.env ? import.meta.env.VITE_ASSETS_PATH_PREFIX || '' : ''
|
|
10
10
|
|
|
11
11
|
export const assetsPath = assetsPathPrefix + '/static/ui-assets/'
|
package/package.json
CHANGED
|
@@ -9,7 +9,15 @@ const getLanguage = () => {
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export const getTranslation = (key, replace) => {
|
|
12
|
-
|
|
12
|
+
const currentLanguage = getLanguage()
|
|
13
|
+
|
|
14
|
+
let translation
|
|
15
|
+
|
|
16
|
+
if (currentLanguage in translations) {
|
|
17
|
+
translation = translations[currentLanguage][key]
|
|
18
|
+
} else {
|
|
19
|
+
translation = translations[DEFAULT_LANGUAGE][key]
|
|
20
|
+
}
|
|
13
21
|
|
|
14
22
|
if (replace) {
|
|
15
23
|
for (key in replace) {
|