add beta language and auto restart when login crowdin

This commit is contained in:
cutls
2021-01-12 14:44:57 +09:00
parent 89b25c56e7
commit f4d6ff8ee3
51 changed files with 21988 additions and 35 deletions

View File

@@ -67,10 +67,8 @@
"add_new": "Add new",
"name": "Name",
"desc": "About this theme",
"customShare": "Share this code with other TheDesk. Do not share this code with MiAS.",
"customImport": "Import of custom themes",
"delete": "Delete",
"cImpWarn": "Get more themes on <a href=\"https://assets.msky.cafe/\" target=\"_blank\">MiAS</a>",
"timeline": "Timeline Preferences",
"timemode": "Time format",
"relativetime": "Relative format:\"1 minutes ago\",\"3 days ago\"",

View File

@@ -66,10 +66,8 @@
"add_new": "新規作成",
"name": "名前",
"desc": "説明",
"customShare": "このコードは他のTheDeskなどとシェアできるけこのコードをMiASに貼るのはあかん。詳細:<a href=\"https://thedesk.top/mias.html\" target=\"_blank\">テーマ互換性</a>",
"customImport": "カスタムテーマのインポート",
"delete": "削除",
"cImpWarn": "<a href=\"https://assets.msky.cafe/\" target=\"_blank\">MiAS</a>上の80を超えるテーマを張っ付けることもできる。",
"timeline": "タイムラインの設定",
"timemode": "時間表記設定",
"relativetime": "相対時間の例:\"1分前\",\"3日前\"",

View File

@@ -67,10 +67,8 @@
"add_new": "新規作成",
"name": "名前",
"desc": "説明",
"customShare": "このコードは他のTheDeskなどとシェアできます。このコードをMiASに貼ることはご遠慮ください。詳細:<a href=\"https://thedesk.top/mias.html\" target=\"_blank\">テーマ互換性</a>",
"customImport": "カスタムテーマのインポート",
"delete": "削除",
"cImpWarn": "<a href=\"https://assets.msky.cafe/\" target=\"_blank\">MiAS</a>上の80を超えるテーマを張り付けることもできます。",
"timeline": "タイムラインの設定",
"timemode": "時間表記設定",
"relativetime": "相対時間の例:\"1分前\",\"3日前\"",

View File

@@ -28,7 +28,8 @@ function main(ver, basefile, pwa, store) {
.trim()
fs.writeFileSync(basefile + 'git', gitHash)
console.log('Constructing view files ' + ver)
const langs = ['ja', 'ja-KS', 'en', 'bg', 'cs', 'de', 'es-AR', 'it-IT', 'ps']
const langs = ['ja', 'ja-KS', 'en', 'bg', 'cs', 'de',
'es-AR', 'it-IT', 'zh-CN', 'zh-TW', 'fr-FR', 'no-NO', 'pt-BR', 'ru-RU', 'es-ES', 'ps']
const langsh = [
'日本語',
'日本語(関西)',
@@ -36,8 +37,15 @@ function main(ver, basefile, pwa, store) {
'български',
'Česky',
'Deutsch',
'Spanish, Argentina',
'Español, argentina',
'italiano',
'简体中文',
'繁體中文(β)',
'français(β)',
'norsk(β)',
'Português, brasileiro(β)',
'русский(β)',
'Español(β)',
'Crowdin translate system(beta)'
]
const simples = ['acct', 'index', 'setting', 'update', 'setting']
@@ -60,28 +68,24 @@ function main(ver, basefile, pwa, store) {
fs.mkdirSync(targetDir)
}
langstr =
langstr +
'<a onclick="changelang(\'' +
lang +
'\')" class="pointer" style="margin:4px;border: 1px solid var(--text); padding: 3px">' +
langsh[n] +
'</a>'
langstr + `<option value="${lang}">${langsh[n]}</option>`
let mainJson = JSON.parse(
fs.readFileSync(basefile + 'view/make/language/' + lang + '/main.json', 'utf8')
)
if (lang == 'ja-KS') {
Object.keys(jaJson).forEach(function(key) {
Object.keys(jaJson).forEach(function (key) {
if (!mainJson[key]) {
mainJson[key] = jaJson[key]
}
})
} else if (lang != 'en') {
Object.keys(enJson).forEach(function(key) {
Object.keys(enJson).forEach(function (key) {
if (!mainJson[key]) {
mainJson[key] = enJson[key]
}
})
}
mainJson.language = lang
fs.writeFileSync(
basefile + 'view/' + lang + '/main.js',
JSON.stringify(mainJson).replace(/^{/, 'var lang = {')
@@ -106,7 +110,7 @@ function main(ver, basefile, pwa, store) {
)
)
if (lang == 'ja') {
Object.keys(target).forEach(function(key) {
Object.keys(target).forEach(function (key) {
refKey.push(key)
let str = target[key]
if (pages[i] == 'setting.vue.js') {
@@ -148,7 +152,7 @@ function main(ver, basefile, pwa, store) {
source = source.replace(/@@gitHashShort@@/g, gitHash.slice(0, 7))
source = source.replace(/@@lang@@/g, lang)
source = source.replace(/@@langlist@@/g, langstr)
if(pwa) {
if (pwa) {
source = source.replace(/@@pwa@@/g, `<link rel="manifest" href="../../manifest.json" />
<script>var pwa = true;"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.pwa.js").then(e=>{});</script>`)
source = source.replace(/@@node_base@@/g, 'dependencies')
@@ -179,9 +183,9 @@ if (process.argv.indexOf('--watch') !== -1) {
ignored: 'view/make/make.js',
persistent: true
})
watcher.on('ready', function() {
watcher.on('ready', function () {
console.log('watching...')
watcher.on('change', function(path) {
watcher.on('change', function (path) {
console.log(path + ' changed.')
main(ver, basefile)
})

View File

@@ -54,7 +54,12 @@
<div class="collapsible-body">
<h5>@@setlang@@</h5>
To translate with Crowdin, you have to login Crowdin and restart TheDesk when login is finished.<br><br>
@@langlist@@
<div style="display: flex;">
<div style="width: 22rem;" id="langsel">
<select id="langsel-sel">@@langlist@@</select>
</div>
<button class="btn waves-effect" onclick="changeLang()">@@change@@</button>
</div>
<h5>@@backup@@</h5>
<button onclick="exportSettings()" class="btn waves-effect lime darken-3"
style="width:100%; max-width:15rem;">@@export@@</button>
@@ -287,9 +292,7 @@
class="btn waves-effect red disabled" id="delTheme" onclick="deleteIt()">@@delete@@</button><br><br>
<input type="text" style="width:22rem;height:40px;" id="custom_json" class="materialize-textarea"
placeholder="JSON style" readonly><br>
@@customShare@@
<h4>@@customImport@@</h4>
@@cImpWarn@@<br>
<input type="text" style="width:22rem;height:40px;" id="custom_import" class="materialize-textarea"
placeholder="JSON/JSON5 style">
<button class="btn waves-effect" onclick="customImp()">@@import@@</button><br>
@@ -343,7 +346,8 @@
@@volwarn80@@<br>
<p class="range-field"><span id="soundVolVal">80</span><br>
<input type="range" id="soundvol" min="0" max="100" value="80" onchange="customVol()"
style="width:40rem; max-width:100%" /></p>
style="width:40rem; max-width:100%" />
</p>
</div>
</li>
<li>
@@ -398,13 +402,15 @@
</li>
<li>
<div class="collapsible-header">
<img src="../../img/aiscript.svg" style="height: 1.5rem; margin-left: 0.4rem; margin-right: 0.4rem;">@@plugin@@
<img src="../../img/aiscript.svg"
style="height: 1.5rem; margin-left: 0.4rem; margin-right: 0.4rem;">@@plugin@@
</div>
<div class="collapsible-body">
<a href="https://github.com/cutls/TheDesk/blob/master/plugin.md">@@howToWritePlugin@@</a><br />
<textarea id="plugin" data-id="add_new" style="height: 20rem"></textarea>
<button class="btn waves-effect" style="width:7.7rem;" onclick="completePlugin()">@@change@@</button>
<button class="btn waves-effect red disabled plugin_delete" style="width:7.7rem;" onclick="deletePlugin()">@@delete@@</button>
<button class="btn waves-effect red disabled plugin_delete" style="width:7.7rem;"
onclick="deletePlugin()">@@delete@@</button>
<h5>@@pluginList@@</h5>
<div style="width:22rem" id="plugin-selector" data-add="@@add_new@@">
<select id="plugin-edit-sel" class="custom-sel" onchange="pluginEdit()">
@@ -511,19 +517,22 @@
<p class="range-field"><span id="voicespeedVal">10</span><br>
<input type="range" id="voicespeed" min="1" max="100" value="10"
onchange="document.getElementById('voicespeedVal').innerText=this.value"
style="width:40rem; max-width:100%" /></p>
style="width:40rem; max-width:100%" />
</p>
<h5>@@pitch@@</h5>
@@pitchwarn@@<br>
<p class="range-field"><span id="voicepitchVal">50</span><br>
<input type="range" id="voicepitch" min="0" max="100" value="50"
onchange="document.getElementById('voicepitchVal').innerText=this.value"
style="width:40rem; max-width:100%" /></p>
style="width:40rem; max-width:100%" />
</p>
<h5>@@vol@@</h5>
@@volwarn@@<br>
<p class="range-field"><span id="voicevolVal">100</span><br>
<input type="range" id="voicevol" min="0" max="100" value="100"
onchange="document.getElementById('voicevolVal').innerText=this.value"
style="width:40rem; max-width:100%" /></p>
style="width:40rem; max-width:100%" />
</p>
<h5>@@test@@</h5>
<input type="text" style="width:27rem" id="voicetxt" value="@@sample@@">
<button class="btn waves-effect blue" style="width:11.5rem;" onclick="voicePlay()"
@@ -608,7 +617,7 @@
</span><br>
TheDeskおよびCutls Pは<a href="https://donken.org/">被災地支援のためのマストドン研究会</a>をログイン機能提供等の形で応援しています。<br>
タグタイムラインを開く:<a href="index.html?mode=tag&code=被災地支援のためのマストドン研究会">#被災地支援のためのマストドン研究会</a><br>
<script type="text/javascript" src="../../@@node_base@@/lodash/lodash.min.js"></script>
<script type="text/javascript" src="../../@@node_base@@/lodash/lodash.min.js"></script>
<script type="text/javascript" src="../../js/platform/aiscript.js"></script>
<script type="text/javascript" src="../../js/platform/plugin.js"></script>
<script type="text/javascript" src="../../js/common/modal.js"></script>