1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-25 08:09:43 +02:00

i18n section strings

This commit is contained in:
McMatts 2022-03-10 15:21:25 -05:00
parent ce9c635fb4
commit 20c9168140
7 changed files with 79 additions and 39 deletions

View file

@ -28,6 +28,7 @@ export default Component.extend(SectionMixin, NotifierMixin, {
},
didReceiveAttrs() {
this._super();
let config = {};
try {

View file

@ -28,6 +28,8 @@ export default Component.extend({
},
didReceiveAttrs() {
this._super();
let pdfOption = {};
try {
@ -46,10 +48,10 @@ export default Component.extend({
this.set('pdfOption', pdfOption);
this.setPDF();
},
didUpdateAttrs() {
this._super(...arguments);
this.setPDF();
this.setPDF();
},
setPDF() {
@ -60,7 +62,7 @@ export default Component.extend({
if (!_.isArray(files)) return;
for (let i=0; i < files.length; i++) {
if (_.endsWith(files[i].get('extension'), 'pdf') &&
if (_.endsWith(files[i].get('extension'), 'pdf') &&
files[i].get('pageId') === this.get('page.id')) {
this.set('pdfName', files[i].get('filename'));
this.set('pdfOption.fileId', files[i].get('id'));

View file

@ -17,11 +17,12 @@ import Component from '@ember/component';
export default Component.extend({
appMeta: service(),
sectionSvc: service('section'),
i18n: service(),
isDirty: false,
waiting: false,
diagramText: '',
diagramPreview: null,
previewButtonCaption: 'Preview',
previewButtonCaption: '',
editorId: computed('page', function () {
let page = this.get('page');
return `plantuml-editor-${page.id}`;
@ -34,9 +35,14 @@ export default Component.extend({
return _.isEmpty(this.get('diagramText'));
}),
init(...args) {
this._super(...args);
this.previewButtonCaption = this.i18n.localize('preview');
},
generatePreview() {
this.set('waiting', true);
this.set('previewButtonCaption', 'Generating preview...');
this.set('previewButtonCaption', this.i18n.localize('preview_wait'));
let self = this;
let data = { data: this.get('diagramText') };
@ -45,11 +51,11 @@ export default Component.extend({
this.get('sectionSvc').fetch(this.get('page'), 'preview', data).then(function (response) {
self.set('diagramPreview', response.data);
self.set('waiting', false);
self.set('previewButtonCaption', 'Preview');
self.set('previewButtonCaption', this.i18n.localize('preview'));
}, function (reason) { // eslint-disable-line no-unused-vars
self.set('diagramPreview', null);
self.set('waiting', false);
self.set('previewButtonCaption', 'Preview');
self.set('previewButtonCaption', this.i18n.localize('preview'));
});
});
},