diff --git a/src/build/i18n.ts b/src/build/i18n.ts index cb71a1939..98b5413a2 100644 --- a/src/build/i18n.ts +++ b/src/build/i18n.ts @@ -7,7 +7,7 @@ import locale from '../../locales'; export default class Replacer { private lang: string; - public pattern = /%i18n:(.+?)%/g; + public pattern = /%i18n:([a-z_\-@\.\!]+?)%/g; constructor(lang: string) { this.lang = lang; @@ -53,11 +53,15 @@ export default class Replacer { } } - public replacement(ctx, match, a, b, c) { + public replacement(ctx, match, key) { const client = 'misskey/src/client/app/'; let name = null; - let key = a || b || c; + const shouldEscape = key[0] == '!'; + if (shouldEscape) { + key = key.substr(1); + } + if (key[0] == '@') { name = ctx.src.substr(ctx.src.indexOf(client) + client.length); key = key.substr(1); @@ -65,6 +69,10 @@ export default class Replacer { if (ctx && ctx.lang) this.lang = ctx.lang; - return this.get(name, key).replace(/'/g, '\\x27').replace(/"/g, '\\x22'); + const txt = this.get(name, key); + + return shouldEscape + ? txt.replace(/'/g, '\\x27').replace(/"/g, '\\x22') + : txt.replace(/"/g, '"'); } } diff --git a/src/client/app/ch/tags/channel.tag b/src/client/app/ch/tags/channel.tag index c0561c9b9..74b1a9ba1 100644 --- a/src/client/app/ch/tags/channel.tag +++ b/src/client/app/ch/tags/channel.tag @@ -252,7 +252,7 @@ diff --git a/src/client/app/ch/tags/index.tag b/src/client/app/ch/tags/index.tag index 88df2ec45..529b83b2c 100644 --- a/src/client/app/ch/tags/index.tag +++ b/src/client/app/ch/tags/index.tag @@ -25,7 +25,7 @@ }); this.n = () => { - const title = window.prompt('%i18n:ch.tags.mk-index.channel-title%'); + const title = window.prompt('%i18n:!ch.tags.mk-index.channel-title%'); this.$root.$data.os.api('channels/create', { title: title diff --git a/src/client/app/common/scripts/check-for-update.ts b/src/client/app/common/scripts/check-for-update.ts index 81c1eb981..20ce64ea8 100644 --- a/src/client/app/common/scripts/check-for-update.ts +++ b/src/client/app/common/scripts/check-for-update.ts @@ -23,7 +23,7 @@ export default async function(mios: MiOS, force = false, silent = false) { } if (!silent) { - alert('%i18n:common.update-available%'.replace('{newer}', newer).replace('{current}', current)); + alert('%i18n:!common.update-available%'.replace('{newer}', newer).replace('{current}', current)); } return newer; diff --git a/src/client/app/common/scripts/streaming/home.ts b/src/client/app/common/scripts/streaming/home.ts index e085801e1..73f2c5302 100644 --- a/src/client/app/common/scripts/streaming/home.ts +++ b/src/client/app/common/scripts/streaming/home.ts @@ -30,7 +30,7 @@ export class HomeStream extends Stream { // トークンが再生成されたとき // このままではAPIが利用できないので強制的にサインアウトさせる this.on('my_token_regenerated', () => { - alert('%i18n:common.my-token-regenerated%'); + alert('%i18n:!common.my-token-regenerated%'); os.signout(); }); } diff --git a/src/client/app/common/views/components/connect-failed.troubleshooter.vue b/src/client/app/common/views/components/connect-failed.troubleshooter.vue index b0a9c87e7..fffabe5a3 100644 --- a/src/client/app/common/views/components/connect-failed.troubleshooter.vue +++ b/src/client/app/common/views/components/connect-failed.troubleshooter.vue @@ -7,21 +7,21 @@ - {{ network == null ? '%i18n:@checking-network%' : '%i18n:@network%' }} + {{ network == null ? '%i18n:!@checking-network%' : '%i18n:!@network%' }}

- {{ internet == null ? '%i18n:@checking-internet%' : '%i18n:@internet%' }} + {{ internet == null ? '%i18n:!@checking-internet%' : '%i18n:!@internet%' }}

- {{ server == null ? '%i18n:@checking-server%' : '%i18n:@server%' }} + {{ server == null ? '%i18n:!@checking-server%' : '%i18n:!@server%' }}

%i18n:@finding%

diff --git a/src/client/app/common/views/components/connect-failed.vue b/src/client/app/common/views/components/connect-failed.vue index d90c8756b..96857c87a 100644 --- a/src/client/app/common/views/components/connect-failed.vue +++ b/src/client/app/common/views/components/connect-failed.vue @@ -3,9 +3,9 @@

%i18n:@title%

- {{ '%i18n:@description%'.substr(0, '%i18n:@description%'.indexOf('{')) }} - {{ '%i18n:@description%'.match(/\{(.+?)\}/)[1] }} - {{ '%i18n:@description%'.substr('%i18n:@description%'.indexOf('}') + 1) }} + {{ '%i18n:!@description%'.substr(0, '%i18n:!@description%'.indexOf('{')) }} + {{ '%i18n:!@description%'.match(/\{(.+?)\}/)[1] }} + {{ '%i18n:!@description%'.substr('%i18n:!@description%'.indexOf('}') + 1) }}

diff --git a/src/client/app/common/views/components/messaging-room.vue b/src/client/app/common/views/components/messaging-room.vue index ca5416a21..38202d758 100644 --- a/src/client/app/common/views/components/messaging-room.vue +++ b/src/client/app/common/views/components/messaging-room.vue @@ -8,7 +8,7 @@

%fa:info-circle%%i18n:@empty%

%fa:flag%%i18n:@no-history%

diff --git a/src/client/app/desktop/views/components/drive.vue b/src/client/app/desktop/views/components/drive.vue index abdf1338b..5e91048d1 100644 --- a/src/client/app/desktop/views/components/drive.vue +++ b/src/client/app/desktop/views/components/drive.vue @@ -138,17 +138,17 @@ export default Vue.extend({ onContextmenu(e) { contextmenu(e, [{ type: 'item', - text: '%i18n:@contextmenu.create-folder%', + text: '%i18n:!@contextmenu.create-folder%', icon: '%fa:R folder%', onClick: this.createFolder }, { type: 'item', - text: '%i18n:@contextmenu.upload%', + text: '%i18n:!@contextmenu.upload%', icon: '%fa:upload%', onClick: this.selectLocalFile }, { type: 'item', - text: '%i18n:@contextmenu.url-upload%', + text: '%i18n:!@contextmenu.url-upload%', icon: '%fa:cloud-upload-alt%', onClick: this.urlUpload }]); @@ -306,15 +306,15 @@ export default Vue.extend({ switch (err) { case 'detected-circular-definition': (this as any).apis.dialog({ - title: '%fa:exclamation-triangle%%i18n:@unable-to-process%', - text: '%i18n:@circular-reference-detected%', + title: '%fa:exclamation-triangle%%i18n:!@unable-to-process%', + text: '%i18n:!@circular-reference-detected%', actions: [{ - text: '%i18n:common.ok%' + text: '%i18n:!common.ok%' }] }); break; default: - alert('%i18n:@unhandled-error% ' + err); + alert('%i18n:!@unhandled-error% ' + err); } }); } @@ -327,8 +327,8 @@ export default Vue.extend({ urlUpload() { (this as any).apis.input({ - title: '%i18n:@url-upload%', - placeholder: '%i18n:@url-of-file%' + title: '%i18n:!@url-upload%', + placeholder: '%i18n:!@url-of-file%' }).then(url => { (this as any).api('drive/files/upload_from_url', { url: url, @@ -337,9 +337,9 @@ export default Vue.extend({ (this as any).apis.dialog({ title: '%fa:check%%i18n:@url-upload-requested%', - text: '%i18n:@may-take-time%', + text: '%i18n:!@may-take-time%', actions: [{ - text: '%i18n:common.ok%' + text: '%i18n:!common.ok%' }] }); }); @@ -347,8 +347,8 @@ export default Vue.extend({ createFolder() { (this as any).apis.input({ - title: '%i18n:@create-folder%', - placeholder: '%i18n:@folder-name%' + title: '%i18n:!@create-folder%', + placeholder: '%i18n:!@folder-name%' }).then(name => { (this as any).api('drive/folders/create', { name: name, diff --git a/src/client/app/desktop/views/components/notes.note.vue b/src/client/app/desktop/views/components/notes.note.vue index 90f9e98a5..326ec4dc8 100644 --- a/src/client/app/desktop/views/components/notes.note.vue +++ b/src/client/app/desktop/views/components/notes.note.vue @@ -9,9 +9,9 @@ avatar %fa:retweet% - {{ '%i18n:@reposted-by%'.substr(0, '%i18n:@reposted-by%'.indexOf('{')) }} + {{ '%i18n:!@reposted-by%'.substr(0, '%i18n:!@reposted-by%'.indexOf('{')) }} {{ note.user | userName }} - {{ '%i18n:@reposted-by%'.substr('%i18n:@reposted-by%'.indexOf('}') + 1) }} + {{ '%i18n:!@reposted-by%'.substr('%i18n:!@reposted-by%'.indexOf('}') + 1) }}

diff --git a/src/client/app/desktop/views/components/notifications.vue b/src/client/app/desktop/views/components/notifications.vue index c1d4c561e..413a87755 100644 --- a/src/client/app/desktop/views/components/notifications.vue +++ b/src/client/app/desktop/views/components/notifications.vue @@ -93,7 +93,7 @@

%i18n:@empty%

%fa:spinner .pulse .fw%%i18n:common.loading%

diff --git a/src/client/app/desktop/views/components/post-form-window.vue b/src/client/app/desktop/views/components/post-form-window.vue index 18bb39f9b..1f0fbff76 100644 --- a/src/client/app/desktop/views/components/post-form-window.vue +++ b/src/client/app/desktop/views/components/post-form-window.vue @@ -4,8 +4,8 @@ %fa:map-marker-alt% %i18n:@note% %i18n:@reply% - {{ '%i18n:@attaches%'.replace('{}', media.length) }} - {{ '%i18n:@uploading-media%'.replace('{}', uploadings.length) }} + {{ '%i18n:!@attaches%'.replace('{}', media.length) }} + {{ '%i18n:!@uploading-media%'.replace('{}', uploadings.length) }} diff --git a/src/client/app/desktop/views/components/post-form.vue b/src/client/app/desktop/views/components/post-form.vue index 6071bbe31..ebb019308 100644 --- a/src/client/app/desktop/views/components/post-form.vue +++ b/src/client/app/desktop/views/components/post-form.vue @@ -28,9 +28,9 @@ -

{{ '%i18n:@text-remain%'.replace('{}', 1000 - text.length) }}

+

{{ '%i18n:!@text-remain%'.replace('{}', 1000 - text.length) }}

@@ -69,17 +69,17 @@ export default Vue.extend({ }, placeholder(): string { return this.renote - ? '%i18n:@quote-placeholder%' + ? '%i18n:!@quote-placeholder%' : this.reply - ? '%i18n:@reply-placeholder%' - : '%i18n:@note-placeholder%'; + ? '%i18n:!@reply-placeholder%' + : '%i18n:!@note-placeholder%'; }, submitText(): string { return this.renote - ? '%i18n:@renote%' + ? '%i18n:!@renote%' : this.reply - ? '%i18n:@reply%' - : '%i18n:@note%'; + ? '%i18n:!@reply%' + : '%i18n:!@note%'; }, canPost(): boolean { return !this.posting && (this.text.length != 0 || this.files.length != 0 || this.poll || this.renote); @@ -236,16 +236,16 @@ export default Vue.extend({ this.deleteDraft(); this.$emit('posted'); (this as any).apis.notify(this.renote - ? '%i18n:@reposted%' + ? '%i18n:!@reposted%' : this.reply - ? '%i18n:@replied%' - : '%i18n:@posted%'); + ? '%i18n:!@replied%' + : '%i18n:!@posted%'); }).catch(err => { (this as any).apis.notify(this.renote - ? '%i18n:@renote-failed%' + ? '%i18n:!@renote-failed%' : this.reply - ? '%i18n:@reply-failed%' - : '%i18n:@note-failed%'); + ? '%i18n:!@reply-failed%' + : '%i18n:!@note-failed%'); }).then(() => { this.posting = false; }); diff --git a/src/client/app/desktop/views/components/renote-form.vue b/src/client/app/desktop/views/components/renote-form.vue index 1f947a71d..daae5df5e 100644 --- a/src/client/app/desktop/views/components/renote-form.vue +++ b/src/client/app/desktop/views/components/renote-form.vue @@ -5,7 +5,7 @@
%i18n:@quote% - +