Skip to content

Commit bbb6807

Browse files
committed
Further i18n work
1 parent 117fd1d commit bbb6807

File tree

13 files changed

+183
-77
lines changed

13 files changed

+183
-77
lines changed

dev/App.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
>
1111
<q-select
1212
:options="[
13-
{ label: 'English', value: 'en' }
13+
{ label: 'English (US)', value: 'en-us' }
14+
,{ label: 'English (UK)', value: 'en-uk' }
1415
,{ label: 'Romanian', value: 'ro' }
1516
,{ label: 'Italian', value: 'it' }
1617
//,{ label: 'Spanish', value: 'es' },
@@ -27,7 +28,7 @@
2728
export default {
2829
data () {
2930
return {
30-
lang: 'en'
31+
lang: 'en-us'
3132
}
3233
},
3334
watch: {

i18n/en.js renamed to i18n/en-uk.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default {
66
close: 'Close',
77
set: 'Set',
88
select: 'Select',
9+
reset: 'Reset',
910
remove: 'Remove',
1011
update: 'Update',
1112
create: 'Create',
@@ -17,7 +18,9 @@ export default {
1718
days: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
1819
daysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
1920
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
20-
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_')
21+
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
22+
firstDayOfWeek: 1, // 0-6, 0 - Sunday, 1 Monday, ...
23+
format24h: true
2124
},
2225
pullToRefresh: {
2326
pull: 'Pull down to refresh',
@@ -56,6 +59,9 @@ export default {
5659
outdent: 'Decrease indentation',
5760
indent: 'Increase indentation',
5861
removeFormat: 'Remove formatting',
62+
formatting: 'Formatting',
63+
fontSize: 'Font Size',
64+
align: 'Align',
5965
hr: 'Insert Horizontal Rule',
6066
undo: 'Undo',
6167
redo: 'Redo',

i18n/en-us.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
export default {
2+
label: {
3+
clear: 'Clear',
4+
ok: 'OK',
5+
cancel: 'Cancel',
6+
close: 'Close',
7+
set: 'Set',
8+
select: 'Select',
9+
reset: 'Reset',
10+
remove: 'Remove',
11+
update: 'Update',
12+
create: 'Create',
13+
search: 'Search',
14+
filter: 'Filter',
15+
refresh: 'Refresh'
16+
},
17+
date: {
18+
days: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
19+
daysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
20+
months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'),
21+
monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
22+
firstDayOfWeek: 0, // 0-6, 0 - Sunday, 1 Monday, ...
23+
format24h: false
24+
},
25+
pullToRefresh: {
26+
pull: 'Pull down to refresh',
27+
release: 'Release to refresh',
28+
refresh: 'Refreshing...'
29+
},
30+
table: {
31+
noData: 'No data available',
32+
noResults: 'No matching records found',
33+
loader: 'Loading...',
34+
selectedRows: rows => rows > 1 ? `${rows} selected row(s).` : `${rows === 0 ? 'No' : '1'} selected rows.`,
35+
rowsPerPage: 'Rows per page:',
36+
allRows: 'All',
37+
pagination: (start, end, total) => `${start}-${end} of ${total}`,
38+
columns: 'Columns'
39+
},
40+
editor: {
41+
link: 'Link',
42+
url: 'URL',
43+
bold: 'Bold',
44+
italic: 'Italic',
45+
strikethrough: 'Strikethrough',
46+
underline: 'Underline',
47+
unorderedList: 'Unordered List',
48+
orderedList: 'Ordered List',
49+
subscript: 'Subscript',
50+
superscript: 'Superscript',
51+
hyperlink: 'Hyperlink',
52+
toggleFullscreen: 'Toggle Fullscreen',
53+
quote: 'Quote',
54+
left: 'Left align',
55+
center: 'Center align',
56+
right: 'Right align',
57+
justify: 'Justify align',
58+
print: 'Print',
59+
outdent: 'Decrease indentation',
60+
indent: 'Increase indentation',
61+
removeFormat: 'Remove formatting',
62+
formatting: 'Formatting',
63+
fontSize: 'Font Size',
64+
align: 'Align',
65+
hr: 'Insert Horizontal Rule',
66+
undo: 'Undo',
67+
redo: 'Redo',
68+
header1: 'Header 1',
69+
header2: 'Header 2',
70+
header3: 'Header 3',
71+
header4: 'Header 4',
72+
header5: 'Header 5',
73+
header6: 'Header 6',
74+
paragraph: 'Paragraph',
75+
code: 'Code',
76+
size1: 'Very small',
77+
size2: 'A bit small',
78+
size3: 'Normal',
79+
size4: 'Medium-large',
80+
size5: 'Big',
81+
size6: 'Very big',
82+
size7: 'Maximum',
83+
defaultFont: 'Default Font'
84+
}
85+
}

i18n/it.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default {
66
close: 'Chiudi',
77
set: 'Imposta',
88
select: 'Seleziona',
9+
reset: 'Risistemare',
910
remove: 'Rimuovi',
1011
update: 'Aggiorna',
1112
create: 'Crea',
@@ -17,7 +18,9 @@ export default {
1718
days: 'Domenica_Lunedì_Martedì_Mercoledì_Giovedì_Venerdì_Sabato'.split('_'),
1819
daysShort: 'Dom_Lun_Mar_Mer_Gio_Ven_Sab'.split('_'),
1920
months: 'Gennaio_Febbraio_Marzo_Aprile_Maggio_Giugno_Luglio_Agosto_Settembre_Ottobre_Novembre_Dicembre'.split('_'),
20-
monthsShort: 'Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic'.split('_')
21+
monthsShort: 'Gen_Feb_Mar_Apr_Mag_Giu_Lug_Ago_Set_Ott_Nov_Dic'.split('_'),
22+
firstDayOfWeek: 1, // 0-6, 0 - Sunday, 1 Monday, ...
23+
format24h: true
2124
},
2225
pullToRefresh: {
2326
pull: 'Tira giù per aggiornare',
@@ -56,6 +59,9 @@ export default {
5659
outdent: 'Diminuisci identazione',
5760
indent: 'Aumenta identazione',
5861
removeFormat: 'Rimuovi formattazione',
62+
formatting: 'Formatazzione',
63+
fontSize: 'Dimensione del font',
64+
align: 'Allineare',
5965
hr: 'Inserisci righello orizzontale',
6066
undo: 'Indietro',
6167
redo: 'Avanti',

i18n/ro.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ export default {
1818
days: 'Duminică_Luni_Marți_Miercuri_Joi_Vineri_Sâmbătă'.split('_'),
1919
daysShort: 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'),
2020
months: 'Ianuarie_Februarie_Martie_Aprilie_Mai_Iunie_Iulie_August_Septembrie_Octombrie_Noiembrie_Decembrie'.split('_'),
21-
monthsShort: 'Ian_Feb_Mar_Apr_Mai_Iun_Iul_Aug_Sep_Oct_Nov_Dec'.split('_')
21+
monthsShort: 'Ian_Feb_Mar_Apr_Mai_Iun_Iul_Aug_Sep_Oct_Nov_Dec'.split('_'),
22+
firstDayOfWeek: 1, // 0-6, 0 - Sunday, 1 Monday, ...
23+
format24h: true
2224
},
2325
pullToRefresh: {
2426
pull: 'Trage în jos pentru actualizare',
@@ -29,7 +31,7 @@ export default {
2931
noData: 'Nu sunt date disponibile',
3032
noResults: 'Nu am găsit înregistrări care să corespundă',
3133
loader: 'Se încarcă...',
32-
selectedRows: rows => `${rows} rânduri selectate.`,
34+
selectedRows: rows => rows > 1 ? `${rows} rânduri selectate.` : `${rows === 0 ? 'Nici un' : '1'} rând selectat.`,
3335
rowsPerPage: 'Rânduri pe pagină:',
3436
allRows: 'Toate',
3537
pagination: (start, end, total) => `${start}-${end} din ${total}`,
@@ -57,6 +59,9 @@ export default {
5759
outdent: 'Decrease indentation',
5860
indent: 'Increase indentation',
5961
removeFormat: 'Remove formatting',
62+
formatting: 'Formatare',
63+
fontSize: 'Marime font',
64+
align: 'Aliniază',
6065
hr: 'Insert Horizontal Rule',
6166
undo: 'Undo',
6267
redo: 'Redo',

src/components/datetime/QDatetime.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
:min="min"
4343
:max="max"
4444
:format24h="format24h"
45-
:monday-first="mondayFirst"
46-
:saturday-first="saturdayFirst"
45+
:first-day-of-week="firstDayOfWeek"
4746
:month-names="$q.i18n.date.months"
4847
:day-names="$q.i18n.date.days"
4948
:color="color"
@@ -77,8 +76,7 @@
7776
:min="min"
7877
:max="max"
7978
:format24h="format24h"
80-
:monday-first="mondayFirst"
81-
:saturday-first="saturdayFirst"
79+
:first-day-of-week="firstDayOfWeek"
8280
:month-names="$q.i18n.date.months"
8381
:day-names="$q.i18n.date.days"
8482
:color="color"

src/components/datetime/QDatetimeRange.vue

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@
2323
:color="color"
2424
:align="align"
2525
:format24h="format24h"
26-
:monday-first="mondayFirst"
27-
:saturday-first="saturdayFirst"
26+
:first-day-of-week="firstDayOfWeek"
2827
class="col q-datetime-range-left"
2928
:class="className"
3029
:style="css"
@@ -54,8 +53,7 @@
5453
:color="color"
5554
:align="align"
5655
:format24h="format24h"
57-
:monday-first="mondayFirst"
58-
:saturday-first="saturdayFirst"
56+
:first-day-of-week="firstDayOfWeek"
5957
class="col q-datetime-range-right"
6058
:class="className"
6159
:style="css"

src/components/datetime/QInlineDatetime.mat.vue

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
{{ __pad(minute) }}
4949
</span>
5050
</div>
51-
<div v-if="!format24h" class="q-datetime-ampm column col-auto col-md-12 justify-around">
51+
<div v-if="!computedFormat24h" class="q-datetime-ampm column col-auto col-md-12 justify-around">
5252
<div
5353
:class="{active: am}"
5454
class="q-datetime-link"
@@ -168,7 +168,7 @@
168168
<div class="q-datetime-clock-pointer" :style="clockPointerStyle">
169169
<span></span>
170170
</div>
171-
<div v-if="format24h">
171+
<div v-if="computedFormat24h">
172172
<div
173173
v-for="n in 24"
174174
class="q-datetime-clock-position fmt24"
@@ -300,15 +300,20 @@ export default {
300300
}
301301
return cls
302302
},
303-
firstDayOfWeek () {
304-
return this.mondayFirst
305-
? 1
306-
: (this.saturdayFirst ? 6 : 0)
303+
computedFormat24h () {
304+
return this.format24h !== void 0
305+
? this.format24h
306+
: this.$q.i18n.date.format24h
307+
},
308+
computedFirstDayOfWeek () {
309+
return this.firstDayOfWeek !== void 0
310+
? this.firstDayOfWeek
311+
: this.$q.i18n.date.firstDayOfWeek
307312
},
308313
headerDayNames () {
309314
const
310315
days = this.$q.i18n.date.daysShort,
311-
first = this.firstDayOfWeek
316+
first = this.computedFirstDayOfWeek
312317
313318
return first > 0
314319
? days.slice(first, 7).concat(days.slice(0, first))
@@ -326,7 +331,7 @@ export default {
326331
},
327332
328333
fillerDays () {
329-
let days = (new Date(this.model.getFullYear(), this.model.getMonth(), 1).getDay() - this.firstDayOfWeek)
334+
let days = (new Date(this.model.getFullYear(), this.model.getMonth(), 1).getDay() - this.computedFirstDayOfWeek)
330335
if (days < 0) {
331336
days += 7
332337
}
@@ -360,7 +365,7 @@ export default {
360365
361366
hour () {
362367
const h = this.model.getHours()
363-
return this.format24h
368+
return this.computedFormat24h
364369
? h
365370
: convertToAmPm(h)
366371
},
@@ -372,7 +377,7 @@ export default {
372377
},
373378
clockPointerStyle () {
374379
let
375-
divider = this.view === 'minute' ? 60 : (this.format24h ? 24 : 12),
380+
divider = this.view === 'minute' ? 60 : (this.computedFormat24h ? 24 : 12),
376381
degrees = Math.round((this.view === 'minute' ? this.minute : this.hour) * (360 / divider)) - 180
377382
378383
return cssTransform(`rotate(${degrees}deg)`)
@@ -411,7 +416,7 @@ export default {
411416
412417
value = this.__parseTypeValue('hour', value)
413418
414-
if (!this.format24h && value < 12 && !this.am) {
419+
if (!this.computedFormat24h && value < 12 && !this.am) {
415420
value += 12
416421
}
417422
@@ -477,7 +482,7 @@ export default {
477482
}
478483
479484
if (this.view === 'hour') {
480-
this.setHour(Math.round(angle / (this.format24h ? 15 : 30)))
485+
this.setHour(Math.round(angle / (this.computedFormat24h ? 15 : 30)))
481486
}
482487
else {
483488
this.setMinute(Math.round(angle / 6))

src/components/datetime/datetime-props.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ export const inline = {
3333
validator: modelValidator,
3434
default: null
3535
},
36-
mondayFirst: Boolean,
37-
saturdayFirst: Boolean,
36+
firstDayOfWeek: Number,
3837
format24h: Boolean
3938
}
4039

src/components/editor/QEditor.js

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { getEventKey } from '../../utils/event'
22
import { getToolbar, getFonts } from './editor-utils'
3-
import { buttons } from './editor-definitions'
43
import { Caret } from './editor-caret'
54
import extend from '../../utils/extend'
65
import FullscreenMixin from '../../mixins/fullscreen'
@@ -64,10 +63,57 @@ export default {
6463
compact: true
6564
}
6665
},
66+
buttonDef () {
67+
const e = this.$q.i18n.editor
68+
69+
return {
70+
bold: {cmd: 'bold', icon: 'format_bold', tip: e.bold, key: 66},
71+
italic: {cmd: 'italic', icon: 'format_italic', tip: e.italic, key: 73},
72+
strike: {cmd: 'strikeThrough', icon: 'strikethrough_s', tip: e.strikethrough, key: 83},
73+
underline: {cmd: 'underline', icon: 'format_underlined', tip: e.underline, key: 85},
74+
unordered: {cmd: 'insertUnorderedList', icon: 'format_list_bulleted', tip: e.unorderedList},
75+
ordered: {cmd: 'insertOrderedList', icon: 'format_list_numbered', tip: e.orderedList},
76+
subscript: {cmd: 'subscript', icon: 'vertical_align_bottom', tip: e.subscript, htmlTip: 'x<subscript>2</subscript>'},
77+
superscript: {cmd: 'superscript', icon: 'vertical_align_top', tip: e.superscript, htmlTip: 'x<superscript>2</superscript>'},
78+
link: {cmd: 'link', icon: 'link', tip: e.hyperlink, key: 76},
79+
fullscreen: {cmd: 'fullscreen', icon: 'fullscreen', tip: e.toggleFullscreen, key: 70},
80+
81+
quote: {cmd: 'formatBlock', param: 'BLOCKQUOTE', icon: 'format_quote', tip: e.quote, key: 81},
82+
left: {cmd: 'justifyLeft', icon: 'format_align_left', tip: e.left},
83+
center: {cmd: 'justifyCenter', icon: 'format_align_center', tip: e.center},
84+
right: {cmd: 'justifyRight', icon: 'format_align_right', tip: e.right},
85+
justify: {cmd: 'justifyFull', icon: 'format_align_justify', tip: e.justify},
86+
87+
print: {type: 'no-state', cmd: 'print', icon: 'print', tip: e.print, key: 80},
88+
outdent: {type: 'no-state', disable: vm => vm.caret && !vm.caret.can('outdent'), cmd: 'outdent', icon: 'format_indent_decrease', tip: e.outdent},
89+
indent: {type: 'no-state', disable: vm => vm.caret && !vm.caret.can('indent'), cmd: 'indent', icon: 'format_indent_increase', tip: e.indent},
90+
removeFormat: {type: 'no-state', cmd: 'removeFormat', icon: 'format_clear', tip: e.removeFormat},
91+
hr: {type: 'no-state', cmd: 'insertHorizontalRule', icon: 'remove', tip: e.hr},
92+
undo: {type: 'no-state', cmd: 'undo', icon: 'undo', tip: e.undo, key: 90},
93+
redo: {type: 'no-state', cmd: 'redo', icon: 'redo', tip: e.redo, key: 89},
94+
95+
h1: {cmd: 'formatBlock', param: 'H1', icon: 'format_size', tip: e.header1, htmlTip: `<h1>${e.header1}</h1>`},
96+
h2: {cmd: 'formatBlock', param: 'H2', icon: 'format_size', tip: e.header2, htmlTip: `<h2>${e.header2}</h2>`},
97+
h3: {cmd: 'formatBlock', param: 'H3', icon: 'format_size', tip: e.header3, htmlTip: `<h3>${e.header3}</h3>`},
98+
h4: {cmd: 'formatBlock', param: 'H4', icon: 'format_size', tip: e.header4, htmlTip: `<h4>${e.header4}</h4>`},
99+
h5: {cmd: 'formatBlock', param: 'H5', icon: 'format_size', tip: e.header5, htmlTip: `<h5>${e.header5}</h5>`},
100+
h6: {cmd: 'formatBlock', param: 'H6', icon: 'format_size', tip: e.header6, htmlTip: `<h6>${e.header6}</h6>`},
101+
p: {cmd: 'formatBlock', param: 'DIV', icon: 'format_size', tip: e.paragraph},
102+
code: {cmd: 'formatBlock', param: 'PRE', icon: 'code', tip: `<code>${e.code}</code>`},
103+
104+
'size-1': {cmd: 'fontSize', param: '1', icon: 'filter_1', tip: e.size1, htmlTip: `<font size="1">${e.size1}</font>`},
105+
'size-2': {cmd: 'fontSize', param: '2', icon: 'filter_2', tip: e.size2, htmlTip: `<font size="2">${e.size2}</font>`},
106+
'size-3': {cmd: 'fontSize', param: '3', icon: 'filter_3', tip: e.size3, htmlTip: `<font size="3">${e.size3}</font>`},
107+
'size-4': {cmd: 'fontSize', param: '4', icon: 'filter_4', tip: e.size4, htmlTip: `<font size="4">${e.size4}</font>`},
108+
'size-5': {cmd: 'fontSize', param: '5', icon: 'filter_5', tip: e.size5, htmlTip: `<font size="5">${e.size5}</font>`},
109+
'size-6': {cmd: 'fontSize', param: '6', icon: 'filter_6', tip: e.size6, htmlTip: `<font size="6">${e.size6}</font>`},
110+
'size-7': {cmd: 'fontSize', param: '7', icon: 'filter_7', tip: e.size7, htmlTip: `<font size="7">${e.size7}</font>`}
111+
}
112+
},
67113
buttons () {
68114
let def = this.definitions || this.fonts
69-
? extend(true, {}, buttons, this.definitions || {}, getFonts(this.defaultFont, this.fonts))
70-
: buttons
115+
? extend(true, {}, this.buttonDef, this.definitions || {}, getFonts(this.defaultFont, this.$q.i18n.editor.defaultFont, this.fonts))
116+
: this.buttonDef
71117

72118
return this.toolbar.map(
73119
group => group.map(token => {

0 commit comments

Comments
 (0)