Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved German language to async loading #44

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions public/assets/de-DE.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"hello": "Gutentag, wie geht's?",
"bye": "Tschüss!",
"replacement": "Mein Name ist {first} {last}, ich bin {age} Jahre alt"
}
6 changes: 1 addition & 5 deletions public/assets/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,5 @@
"bye": "Au revoir!",
"replacement": "Je m'appelle {first} {last}, j'ai {age} ans"
},
"de-DE": {
"hello": "Gutentag, wie geht's?",
"bye": "Tschüss!",
"replacement": "Mein Name ist {first} {last}, ich bin {age} Jahre alt"
}
"de-DE": "/assets/de-DE.json"
}
6 changes: 2 additions & 4 deletions src/pages/LanguagePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ export default Blits.Component('LanguagePlugin', {
<Flags languages="$languages" ref="flags" x="500" y="150" />
<Text x="960" y="540" mount="0.5" :content="$$language.translate('hello')" size="80" />
<Text x="960" y="640" mount="0.5" :content="$$language.translate('bye')" size="50" />

<Text
x="960"
y="720"
mount="0.5"
:content="$$language.translate('replacement', {first: 'John', last: 'Doe', age: 18})"
size="36"
/>

<Text
size="32"
x="960"
Expand All @@ -45,7 +43,7 @@ export default Blits.Component('LanguagePlugin', {
:content="'Current language: ' + $$language.language + '\n Language file: ' + ($loaded === true ? 'Loaded' : 'loading ...')"
/>
</Element>
`,
`,
state() {
return {
loaded: false,
Expand Down Expand Up @@ -108,7 +106,7 @@ export default Blits.Component('LanguagePlugin', {
// })
},
focus() {
this.select('flags').focus()
this.$select('flags').$focus()
},
},
})