Skip to content

Commit

Permalink
i18n for title
Browse files Browse the repository at this point in the history
  • Loading branch information
zyr17 committed Jan 4, 2024
1 parent 10dee6f commit 3eed7bd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<link rel="icon" href="favicon.png" type="image/png">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>水皇模拟器</title>
<meta name="description" content="水皇模拟器"/>
<meta name="description" content="LPSim"/>
</head>
<body>
<div id="app"></div>
Expand Down
5 changes: 4 additions & 1 deletion src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@ export default {
},
created() {
this.$store.commit('readFromLocalStorage');
// set language to update title
// log data when created
console.log('APP', this);
Expand All @@ -334,6 +335,7 @@ export default {
// set current language
this.$root.$i18n.locale = this.currentLanguage;
this.currentLanguage = this.currentLanguage;
// auto load logs.txt. when debug, it avoids manually loading data.
// const logFilePath = 'logs.txt';
Expand Down Expand Up @@ -675,8 +677,8 @@ export default {
// select next language
let keys = Object.keys(this.$i18n.messages).sort();
let position = keys.indexOf(this.currentLanguage);
this.$root.$i18n.locale = keys[(position + 1) % keys.length];
this.currentLanguage = keys[(position + 1) % keys.length];
this.$root.$i18n.locale = this.currentLanguage;
console.log('Change language to ' + this.currentLanguage);
}
},
Expand Down Expand Up @@ -1658,6 +1660,7 @@ export default {
},
set (value) {
this.$store.commit('setFrontendLanguage', value);
document.title = this.$t('LPSim: Title');
}
},
animationInterval: {
Expand Down
1 change: 1 addition & 0 deletions src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"Error in update match data. ": "Error in update match data. ",
" is not equal to current match length ": " is not equal to current match length {n}. ",
"Background message, click to hide": "Background sent message, click to hide",
"LPSim: Title": "LPSim: Lochfolk Prinzessin Simulator",

"SKILL_TYPE/NORMAL_ATTACK": "Normal Attack",
"SKILL_TYPE/ELEMENTAL_SKILL": "Elemental Skill",
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
"Error in update match data. ": "更新对战数据时发生错误。",
" is not equal to current match length ": " 与当前对战帧数长度 {n} 不相等。",
"Background message, click to hide": "后台发送消息,点击隐藏",
"LPSim: Title": "LPSim:水皇模拟器",

"SKILL_TYPE/NORMAL_ATTACK": "普通攻击",
"SKILL_TYPE/ELEMENTAL_SKILL": "元素战技",
Expand Down

0 comments on commit 3eed7bd

Please sign in to comment.