diff --git a/src/client/app/mobile/views/pages/drive.vue b/src/client/app/mobile/views/pages/drive.vue
index 200379f22..2cf3f510a 100644
--- a/src/client/app/mobile/views/pages/drive.vue
+++ b/src/client/app/mobile/views/pages/drive.vue
@@ -3,7 +3,7 @@
%fa:R folder-open%{{ folder.name }}
{{ file.name }}
- %fa:cloud%%i18n:mobile.tags.mk-drive-page.drive%
+ %fa:cloud%%i18n:@drive%
- {{ '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', name) }}
+ {{ '%i18n:@followers-of%'.replace('{}', name) }}
- %i18n:mobile.tags.mk-user-followers.no-users%
+ %i18n:@no-users%
@@ -52,7 +52,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
- document.title = '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', this.name) + ' | Misskey';
+ document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | Misskey';
});
},
onLoaded() {
diff --git a/src/client/app/mobile/views/pages/following.vue b/src/client/app/mobile/views/pages/following.vue
index d0dcc117c..8dbdd5dba 100644
--- a/src/client/app/mobile/views/pages/following.vue
+++ b/src/client/app/mobile/views/pages/following.vue
@@ -2,7 +2,7 @@
- {{ '%i18n:mobile.tags.mk-user-following-page.following-of%'.replace('{}', name) }}
+ {{ '%i18n:@following-of%'.replace('{}', name) }}
- %i18n:mobile.tags.mk-user-following.no-users%
+ %i18n:@no-users%
@@ -51,7 +51,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
- document.title = '%i18n:mobile.tags.mk-user-followers-page.followers-of%'.replace('{}', this.name) + ' | Misskey';
+ document.title = '%i18n:@followers-of%'.replace('{}', this.name) + ' | Misskey';
});
},
onLoaded() {
diff --git a/src/client/app/mobile/views/pages/messaging-room.vue b/src/client/app/mobile/views/pages/messaging-room.vue
index 3b6fb11db..c26a9b735 100644
--- a/src/client/app/mobile/views/pages/messaging-room.vue
+++ b/src/client/app/mobile/views/pages/messaging-room.vue
@@ -33,7 +33,7 @@ export default Vue.extend({
this.user = user;
this.fetching = false;
- document.title = `%i18n:mobile.tags.mk-messaging-room-page.message%: ${Vue.filter('userName')(this.user)} | Misskey`;
+ document.title = `%i18n:@messaging%: ${Vue.filter('userName')(this.user)} | Misskey`;
});
}
}
diff --git a/src/client/app/mobile/views/pages/messaging.vue b/src/client/app/mobile/views/pages/messaging.vue
index fa735a253..cc328e5a1 100644
--- a/src/client/app/mobile/views/pages/messaging.vue
+++ b/src/client/app/mobile/views/pages/messaging.vue
@@ -1,6 +1,6 @@
- %fa:R comments%%i18n:mobile.tags.mk-messaging-page.message%
+ %fa:R comments%%i18n:@messaging%
@@ -11,7 +11,7 @@ import getAcct from '../../../../../acct/render';
export default Vue.extend({
mounted() {
- document.title = 'Misskey %i18n:mobile.tags.mk-messaging-page.message%';
+ document.title = 'Misskey %i18n:@messaging%';
document.documentElement.style.background = '#fff';
},
methods: {
diff --git a/src/client/app/mobile/views/pages/note.vue b/src/client/app/mobile/views/pages/note.vue
index 89b8c776f..c866be8a1 100644
--- a/src/client/app/mobile/views/pages/note.vue
+++ b/src/client/app/mobile/views/pages/note.vue
@@ -1,12 +1,12 @@
- %fa:R sticky-note%%i18n:mobile.tags.mk-note-page.title%
+ %fa:R sticky-note%%i18n:@title%
- %fa:angle-up%%i18n:mobile.tags.mk-note-page.next%
+ %fa:angle-up%%i18n:@next%
- %fa:angle-down%%i18n:mobile.tags.mk-note-page.prev%
+ %fa:angle-down%%i18n:@prev%
diff --git a/src/client/app/mobile/views/pages/notifications.vue b/src/client/app/mobile/views/pages/notifications.vue
index 6d45e22a9..5ae94590c 100644
--- a/src/client/app/mobile/views/pages/notifications.vue
+++ b/src/client/app/mobile/views/pages/notifications.vue
@@ -1,6 +1,6 @@
- %fa:R bell%%i18n:mobile.tags.mk-notifications-page.notifications%
+ %fa:R bell%%i18n:@notifications%
@@ -12,14 +12,14 @@ import Progress from '../../../common/scripts/loading';
export default Vue.extend({
mounted() {
- document.title = 'Misskey | %i18n:mobile.tags.mk-notifications-page.notifications%';
+ document.title = 'Misskey | %i18n:@notifications%';
document.documentElement.style.background = '#313a42';
Progress.start();
},
methods: {
fn() {
- const ok = window.confirm('%i18n:mobile.tags.mk-notifications-page.read-all%');
+ const ok = window.confirm('%i18n:@read-all%');
if (!ok) return;
(this as any).api('notifications/markAsRead_all');
diff --git a/src/client/app/mobile/views/pages/profile-setting.vue b/src/client/app/mobile/views/pages/profile-setting.vue
index 7f0ff5aad..846be5995 100644
--- a/src/client/app/mobile/views/pages/profile-setting.vue
+++ b/src/client/app/mobile/views/pages/profile-setting.vue
@@ -1,38 +1,38 @@
- %fa:user%%i18n:mobile.tags.mk-profile-setting-page.title%
+ %fa:user%%i18n:@title%
-
%fa:info-circle%%i18n:mobile.tags.mk-profile-setting.will-be-published%
+
%fa:info-circle%%i18n:@will-be-published%
-
+
@@ -58,7 +58,7 @@ export default Vue.extend({
this.birthday = (this as any).os.i.profile.birthday;
},
mounted() {
- document.title = 'Misskey | %i18n:mobile.tags.mk-profile-setting-page.title%';
+ document.title = 'Misskey | %i18n:@title%';
document.documentElement.style.background = '#313a42';
},
methods: {
@@ -72,7 +72,7 @@ export default Vue.extend({
avatarId: file.id
}).then(() => {
this.avatarSaving = false;
- alert('%i18n:mobile.tags.mk-profile-setting.avatar-saved%');
+ alert('%i18n:@avatar-saved%');
});
});
},
@@ -86,7 +86,7 @@ export default Vue.extend({
bannerId: file.id
}).then(() => {
this.bannerSaving = false;
- alert('%i18n:mobile.tags.mk-profile-setting.banner-saved%');
+ alert('%i18n:@banner-saved%');
});
});
},
@@ -100,7 +100,7 @@ export default Vue.extend({
birthday: this.birthday || null
}).then(() => {
this.saving = false;
- alert('%i18n:mobile.tags.mk-profile-setting.saved%');
+ alert('%i18n:@saved%');
});
}
}
diff --git a/src/client/app/mobile/views/pages/search.vue b/src/client/app/mobile/views/pages/search.vue
index a96832bee..2ea2c7338 100644
--- a/src/client/app/mobile/views/pages/search.vue
+++ b/src/client/app/mobile/views/pages/search.vue
@@ -3,9 +3,9 @@
%fa:search% {{ q }}
- {{ '%i18n:mobile.tags.mk-search-notes.empty%'.replace('{}', q) }}
+ {{ '%i18n:@empty%'.replace('{}', q) }}
@@ -38,7 +38,7 @@ export default Vue.extend({
}
},
mounted() {
- document.title = `%i18n:mobile.tags.mk-search-page.search%: ${this.q} | Misskey`;
+ document.title = `%i18n:@search%: ${this.q} | Misskey`;
document.documentElement.style.background = '#313a42';
this.fetch();
diff --git a/src/client/app/mobile/views/pages/selectdrive.vue b/src/client/app/mobile/views/pages/selectdrive.vue
index 3480a0d10..e8e256cae 100644
--- a/src/client/app/mobile/views/pages/selectdrive.vue
+++ b/src/client/app/mobile/views/pages/selectdrive.vue
@@ -1,7 +1,7 @@
- %i18n:mobile.tags.mk-selectdrive-page.select-file%({{ files.length }})
+ %i18n:@select-file%({{ files.length }})
@@ -25,7 +25,7 @@ export default Vue.extend({
}
},
mounted() {
- document.title = '%i18n:desktop.tags.mk-selectdrive-page.title%';
+ document.title = '%i18n:@title%';
},
methods: {
onSelected(file) {
diff --git a/src/client/app/mobile/views/pages/settings.vue b/src/client/app/mobile/views/pages/settings.vue
index 8d248f5cb..36f7f09b8 100644
--- a/src/client/app/mobile/views/pages/settings.vue
+++ b/src/client/app/mobile/views/pages/settings.vue
@@ -1,16 +1,15 @@
- %fa:cog%%i18n:mobile.tags.mk-settings-page.settings%
+ %fa:cog%%i18n:@settings%
-
+
- - %fa:user%%i18n:mobile.tags.mk-settings-page.profile%%fa:angle-right%
- - %fa:puzzle-piece%%i18n:mobile.tags.mk-settings-page.applications%%fa:angle-right%
- - %fa:B twitter%%i18n:mobile.tags.mk-settings-page.twitter-integration%%fa:angle-right%
- - %fa:sign-in-alt%%i18n:mobile.tags.mk-settings-page.signin-history%%fa:angle-right%
+ - %fa:user%%i18n:@profile%%fa:angle-right%
+ - %fa:B twitter%%i18n:@twitter%%fa:angle-right%
+ - %fa:sign-in-alt%%i18n:@signin-history%%fa:angle-right%
ver {{ version }} ({{ codename }})
@@ -34,7 +33,7 @@ export default Vue.extend({
}
},
mounted() {
- document.title = 'Misskey | %i18n:mobile.tags.mk-settings-page.settings%';
+ document.title = 'Misskey | %i18n:@settings%';
document.documentElement.style.background = '#313a42';
},
methods: {
diff --git a/src/client/app/mobile/views/pages/user.vue b/src/client/app/mobile/views/pages/user.vue
index 3d9fbda94..ea384308e 100644
--- a/src/client/app/mobile/views/pages/user.vue
+++ b/src/client/app/mobile/views/pages/user.vue
@@ -14,7 +14,7 @@
{{ user | userName }}
@{{ user | acct }}
- %i18n:mobile.tags.mk-user.follows-you%
+ %i18n:@follows-you%
{{ user.description }}
diff --git a/src/client/app/mobile/views/pages/user/home.followers-you-know.vue b/src/client/app/mobile/views/pages/user/home.followers-you-know.vue
index 2841c0d63..6f809d889 100644
--- a/src/client/app/mobile/views/pages/user/home.followers-you-know.vue
+++ b/src/client/app/mobile/views/pages/user/home.followers-you-know.vue
@@ -1,12 +1,12 @@
-
%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-followers-you-know.loading%
+
%fa:spinner .pulse .fw%%i18n:@loading%
-
%i18n:mobile.tags.mk-user-overview-followers-you-know.no-users%
+
%i18n:@no-users%
diff --git a/src/client/app/mobile/views/pages/user/home.friends.vue b/src/client/app/mobile/views/pages/user/home.friends.vue
index 469781abb..cf257b124 100644
--- a/src/client/app/mobile/views/pages/user/home.friends.vue
+++ b/src/client/app/mobile/views/pages/user/home.friends.vue
@@ -1,10 +1,10 @@
-
%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-frequently-replied-users.loading%
+
%fa:spinner .pulse .fw%%i18n:@loading%
-
%i18n:mobile.tags.mk-user-overview-frequently-replied-users.no-users%
+
%i18n:@no-users%
diff --git a/src/client/app/mobile/views/pages/user/home.notes.vue b/src/client/app/mobile/views/pages/user/home.notes.vue
index 02afed9b8..6483402a5 100644
--- a/src/client/app/mobile/views/pages/user/home.notes.vue
+++ b/src/client/app/mobile/views/pages/user/home.notes.vue
@@ -1,10 +1,10 @@
-
%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-notes.loading%
+
%fa:spinner .pulse .fw%%i18n:@loading%
-
%i18n:mobile.tags.mk-user-overview-notes.no-notes%
+
%i18n:@no-notes%
diff --git a/src/client/app/mobile/views/pages/user/home.photos.vue b/src/client/app/mobile/views/pages/user/home.photos.vue
index 0e0d6926a..bfd2aa833 100644
--- a/src/client/app/mobile/views/pages/user/home.photos.vue
+++ b/src/client/app/mobile/views/pages/user/home.photos.vue
@@ -1,6 +1,6 @@
-
%fa:spinner .pulse .fw%%i18n:mobile.tags.mk-user-overview-photos.loading%
+
%fa:spinner .pulse .fw%%i18n:@loading%
-
%i18n:mobile.tags.mk-user-overview-photos.no-photos%
+
%i18n:@no-photos%
diff --git a/src/client/app/mobile/views/pages/user/home.vue b/src/client/app/mobile/views/pages/user/home.vue
index c0cd9b8da..4ba2ffd1d 100644
--- a/src/client/app/mobile/views/pages/user/home.vue
+++ b/src/client/app/mobile/views/pages/user/home.vue
@@ -2,36 +2,36 @@
- %fa:R comments%%i18n:mobile.tags.mk-user-overview.recent-notes%
+ %fa:R comments%%i18n:@recent-notes%
- %fa:image%%i18n:mobile.tags.mk-user-overview.images%
+ %fa:image%%i18n:@images%
- %fa:chart-bar%%i18n:mobile.tags.mk-user-overview.activity%
+ %fa:chart-bar%%i18n:@activity%
- %fa:users%%i18n:mobile.tags.mk-user-overview.frequently-replied-users%
+ %fa:users%%i18n:@frequently-replied-users%
- %fa:users%%i18n:mobile.tags.mk-user-overview.followers-you-know%
+ %fa:users%%i18n:@followers-you-know%
-
%i18n:mobile.tags.mk-user-overview.last-used-at%:
+
%i18n:@last-used-at%:
diff --git a/src/client/docs/api/gulpfile.ts b/src/client/docs/api/gulpfile.ts
index 9980ede23..31027c0be 100644
--- a/src/client/docs/api/gulpfile.ts
+++ b/src/client/docs/api/gulpfile.ts
@@ -127,7 +127,7 @@ gulp.task('doc:api:endpoints', async () => {
return;
}
const i18n = new I18nReplacer(lang);
- html = html.replace(i18n.pattern, i18n.replacement);
+ html = html.replace(i18n.pattern, i18n.replacement.bind(null, null));
html = fa(html);
const htmlPath = `./built/client/docs/${lang}/api/endpoints/${ep.endpoint}.html`;
mkdirp(path.dirname(htmlPath), (mkdirErr) => {
@@ -171,7 +171,7 @@ gulp.task('doc:api:entities', async () => {
return;
}
const i18n = new I18nReplacer(lang);
- html = html.replace(i18n.pattern, i18n.replacement);
+ html = html.replace(i18n.pattern, i18n.replacement.bind(null, null));
html = fa(html);
const htmlPath = `./built/client/docs/${lang}/api/entities/${kebab(entity.name)}.html`;
mkdirp(path.dirname(htmlPath), (mkdirErr) => {
diff --git a/src/client/docs/gulpfile.ts b/src/client/docs/gulpfile.ts
index 56bf6188c..5e81d6d3b 100644
--- a/src/client/docs/gulpfile.ts
+++ b/src/client/docs/gulpfile.ts
@@ -53,7 +53,7 @@ gulp.task('doc:docs', async () => {
return;
}
const i18n = new I18nReplacer(lang);
- html = html.replace(i18n.pattern, i18n.replacement);
+ html = html.replace(i18n.pattern, i18n.replacement.bind(null, null));
html = fa(html);
const htmlPath = `./built/client/docs/${lang}/${name}.html`;
mkdirp(path.dirname(htmlPath), (mkdirErr) => {
diff --git a/webpack.config.ts b/webpack.config.ts
index 60dbfd2ff..bc876e067 100644
--- a/webpack.config.ts
+++ b/webpack.config.ts
@@ -42,7 +42,7 @@ const langs = Object.keys(locales);
const entries = process.env.NODE_ENV == 'production'
? langs.map(l => [l, false]).concat(langs.map(l => [l, true]))
- : [['ja', false]];
+ : langs.map(l => [l, false]);
module.exports = entries.map(x => {
const [lang, isProduction] = x;
@@ -143,7 +143,9 @@ module.exports = entries.map(x => {
loader: 'replace',
query: {
search: i18nReplacer.pattern.toString(),
- replace: 'i18nReplacement'
+ replace: 'i18nReplacement',
+ i18n: true,
+ lang
}
}, {
loader: 'replace',
@@ -214,7 +216,9 @@ module.exports = entries.map(x => {
loader: 'replace',
query: {
search: i18nReplacer.pattern.toString(),
- replace: 'i18nReplacement'
+ replace: 'i18nReplacement',
+ i18n: true,
+ lang
}
}, {
loader: 'replace',
diff --git a/webpack/loaders/replace.js b/webpack/loaders/replace.js
index 03cf1fcd7..0326dcdab 100644
--- a/webpack/loaders/replace.js
+++ b/webpack/loaders/replace.js
@@ -9,7 +9,11 @@ module.exports = function(src) {
const options = loaderUtils.getOptions(this);
const search = options.search;
const g = search[search.length - 1] == 'g';
- const replace = global[options.replace];
+ const file = this.resourcePath.replace(/\\/g, '/');
+ const replace = options.i18n ? global[options.replace].bind(null, {
+ src: file,
+ lang: options.lang
+ }) : global[options.replace];
if (typeof search != 'string' || search.length == 0) console.error('invalid search');
if (typeof replace != 'function') console.error('invalid replacer:', replace, this.request);
src = src.replace(new RegExp(trim(search, g), g ? 'g' : ''), replace);