Refactoring of i18n (#3165)

Refactoring of i18n
This commit is contained in:
syuilo
2018-11-09 03:44:35 +09:00
committed by GitHub
parent 21303bd06a
commit 25a69ec1b6
211 changed files with 1825 additions and 1624 deletions

View File

@ -6,28 +6,30 @@
<script lang="ts">
import Vue from 'vue';
import i18n from '../../../i18n';
import { url } from '../../../config';
import copyToClipboard from '../../../common/scripts/copy-to-clipboard';
import Ok from './ok.vue';
export default Vue.extend({
i18n: i18n('common/views/components/note-menu.vue'),
props: ['note', 'source', 'compact'],
computed: {
items() {
const items = [{
icon: 'info-circle',
text: '%i18n:@detail%',
text: this.$t('detail'),
action: this.detail
}, {
icon: 'link',
text: '%i18n:@copy-link%',
text: this.$t('copy-link'),
action: this.copyLink
}];
if (this.note.uri) {
items.push({
icon: 'external-link-square-alt',
text: '%i18n:@remote%',
text: this.$t('remote'),
action: () => {
window.open(this.note.uri, '_blank');
}
@ -39,13 +41,13 @@ export default Vue.extend({
if (this.note.isFavorited) {
items.push({
icon: 'star',
text: '%i18n:@unfavorite%',
text: this.$t('unfavorite'),
action: this.unfavorite
});
} else {
items.push({
icon: 'star',
text: '%i18n:@favorite%',
text: this.$t('favorite'),
action: this.favorite
});
}
@ -54,13 +56,13 @@ export default Vue.extend({
if ((this.$store.state.i.pinnedNoteIds || []).includes(this.note.id)) {
items.push({
icon: 'thumbtack',
text: '%i18n:@unpin%',
text: this.$t('unpin'),
action: this.unpin
});
} else {
items.push({
icon: 'thumbtack',
text: '%i18n:@pin%',
text: this.$t('pin'),
action: this.pin
});
}
@ -70,7 +72,7 @@ export default Vue.extend({
items.push(null);
items.push({
icon: ['far', 'trash-alt'],
text: '%i18n:@delete%',
text: this.$t('delete'),
action: this.del
});
}
@ -106,7 +108,7 @@ export default Vue.extend({
},
del() {
if (!window.confirm('%i18n:@delete-confirm%')) return;
if (!window.confirm(this.$t('delete-confirm'))) return;
(this as any).api('notes/delete', {
noteId: this.note.id
}).then(() => {