Skip to content

Commit

Permalink
Fix languages in dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Jun 13, 2024
1 parent 721cf83 commit c2f6b30
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions app/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { _, addMessages, init, getLocaleFromNavigator, locale } from 'svelte-i18
import { get } from 'svelte/store';
import en from '../i18n/en.json';

window.APP_LANGUAGES = JSON.parse(__GMPUBLISHER_APP_LANGUAGES__);

{
for (let file in window.APP_LANGUAGES) {
if (file === 'en') continue;
Expand Down
6 changes: 3 additions & 3 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,6 @@ export default defineConfig(async () => ({
input: {
app: './app/index.html',
},
output: {
intro: `window.APP_LANGUAGES = ${JSON.stringify(appLanguages)};`
},
plugins: [
replace({
'process.env.NODE_ENV': JSON.stringify(
Expand All @@ -63,4 +60,7 @@ export default defineConfig(async () => ({
]
},
},
define: {
'__GMPUBLISHER_APP_LANGUAGES__': JSON.stringify(JSON.stringify(appLanguages))
}
}));

0 comments on commit c2f6b30

Please sign in to comment.