Skip to content

Commit

Permalink
start of i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
ianopolous committed Feb 12, 2024
1 parent 711509d commit 110fb1f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</label>

<AppButton :disabled="isLoggingIn" class="login" @click.native="login()" type="primary" block accent icon="arrow-right">
Sign in
{{ translate('LOGIN.BUTTON') }}
</AppButton>
</div>
</template>
Expand All @@ -41,6 +41,7 @@ const FormPassword = require("./form/FormPassword.vue");
const MultiFactorAuth = require("./auth/MultiFactorAuth.vue");
const routerMixins = require("../mixins/router/index.js");
const UriDecoder = require('../mixins/uridecoder/index.js');
const i18n = require("../i18n/index.js");
module.exports = {
components: {
Expand Down Expand Up @@ -69,7 +70,7 @@ module.exports = {
'isSecretLink',
]),
},
mixins:[routerMixins, UriDecoder],
mixins:[routerMixins, UriDecoder, i18n],
mounted() {
this.$refs.username.focus()
Expand Down
3 changes: 3 additions & 0 deletions src/i18n/en-GB.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
"LOGIN.BUTTON":"Sign in"
}
17 changes: 17 additions & 0 deletions src/i18n/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const enGB = require("en-GB.js")

const supported = ["en-GB"]
module.exports = {

methods: {
translate(label, locale) {
if (locale == null)
locale = navigator.language;
if (!supported.includes(locale))
locale = "en-GB";
if (locale == "en-GB") {
return enGB[label];
}
}
}
}

0 comments on commit 110fb1f

Please sign in to comment.