mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-24 06:59:52 +01:00
vue ui i18n: localized days of week and initials in calendar view
This commit is contained in:
parent
d216c8de1f
commit
ccfcb2bf52
File diff suppressed because one or more lines are too long
@ -44,6 +44,20 @@ html, body
|
|||||||
oct_short: "{{ _Q('Oct') }}",
|
oct_short: "{{ _Q('Oct') }}",
|
||||||
nov_short: "{{ _Q('Nov') }}",
|
nov_short: "{{ _Q('Nov') }}",
|
||||||
dec_short: "{{ _Q('Dec') }}",
|
dec_short: "{{ _Q('Dec') }}",
|
||||||
|
mon_short: "{{ _Q('Mon') }}",
|
||||||
|
tue_short: "{{ _Q('Tue') }}",
|
||||||
|
wed_short: "{{ _Q('Wed') }}",
|
||||||
|
thu_short: "{{ _Q('Thu') }}",
|
||||||
|
fri_short: "{{ _Q('Fri') }}",
|
||||||
|
sat_short: "{{ _Q('Sat') }}",
|
||||||
|
sun_short: "{{ _Q('Sun') }}",
|
||||||
|
mon_long: "{{ _Q('Monday') }}",
|
||||||
|
tue_long: "{{ _Q('Tuesday') }}",
|
||||||
|
wed_long: "{{ _Q('Wednesday') }}",
|
||||||
|
thu_long: "{{ _Q('Thursday') }}",
|
||||||
|
fri_long: "{{ _Q('Friday') }}",
|
||||||
|
sat_long: "{{ _Q('Saturday') }}",
|
||||||
|
sun_long: "{{ _Q('Sunday') }}",
|
||||||
"All-time": "{{ _Q('All-time') }}",
|
"All-time": "{{ _Q('All-time') }}",
|
||||||
"show timeline":"{{ _Q('show timeline') }}",
|
"show timeline":"{{ _Q('show timeline') }}",
|
||||||
"hide timeline":"{{ _Q('hide timeline') }}",
|
"hide timeline":"{{ _Q('hide timeline') }}",
|
||||||
|
@ -44,6 +44,20 @@
|
|||||||
oct_short: "{{ _Q('Oct') }}",
|
oct_short: "{{ _Q('Oct') }}",
|
||||||
nov_short: "{{ _Q('Nov') }}",
|
nov_short: "{{ _Q('Nov') }}",
|
||||||
dec_short: "{{ _Q('Dec') }}",
|
dec_short: "{{ _Q('Dec') }}",
|
||||||
|
mon_short: "{{ _Q('Mon') }}",
|
||||||
|
tue_short: "{{ _Q('Tue') }}",
|
||||||
|
wed_short: "{{ _Q('Wed') }}",
|
||||||
|
thu_short: "{{ _Q('Thu') }}",
|
||||||
|
fri_short: "{{ _Q('Fri') }}",
|
||||||
|
sat_short: "{{ _Q('Sat') }}",
|
||||||
|
sun_short: "{{ _Q('Sun') }}",
|
||||||
|
mon_long: "{{ _Q('Monday') }}",
|
||||||
|
tue_long: "{{ _Q('Tuesday') }}",
|
||||||
|
wed_long: "{{ _Q('Wednesday') }}",
|
||||||
|
thu_long: "{{ _Q('Thursday') }}",
|
||||||
|
fri_long: "{{ _Q('Friday') }}",
|
||||||
|
sat_long: "{{ _Q('Saturday') }}",
|
||||||
|
sun_long: "{{ _Q('Sunday') }}",
|
||||||
"All-time": "{{ _Q('All-time') }}",
|
"All-time": "{{ _Q('All-time') }}",
|
||||||
"show timeline":"{{ _Q('show timeline') }}",
|
"show timeline":"{{ _Q('show timeline') }}",
|
||||||
"hide timeline":"{{ _Q('hide timeline') }}",
|
"hide timeline":"{{ _Q('hide timeline') }}",
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
<div class="calendar-month" :class="{current: isCurrent, 'contains-current-snapshot': containsCurrentSnapshot}">
|
<div class="calendar-month" :class="{current: isCurrent, 'contains-current-snapshot': containsCurrentSnapshot}">
|
||||||
<h3>{{getLongMonthName(month.id)}} <span v-if="month.snapshotCount">({{ month.snapshotCount }})</span></h3>
|
<h3>{{getLongMonthName(month.id)}} <span v-if="month.snapshotCount">({{ month.snapshotCount }})</span></h3>
|
||||||
<div v-if="month.snapshotCount">
|
<div v-if="month.snapshotCount">
|
||||||
<span v-for="(day) in ['S', 'M', 'T', 'W', 'H', 'F', 'S']" class="day" :style="dayStyle">{{day}}</span><br/>
|
<span v-for="(dayInitial) in dayInitials" class="day" :style="dayStyle">{{dayInitial}}</span><br/>
|
||||||
<span v-for="(day,i) in days"><br v-if="i && i % 7===0"/><span class="day" :class="{empty: !day || !day.snapshotCount, 'contains-current-snapshot':dayContainsCurrentSnapshot(day)}" :style="dayStyle" @click="gotoDay(day, $event)"><template v-if="day"><span class="size" v-if="day.snapshotCount" :style="getDayCountCircleStyle(day.snapshotCount)"> </span><span class="day-id">{{day.id}}</span><span v-if="day.snapshotCount" class="count">{{ $root._(day.snapshotCount !== 1 ? '{count} captures':'{count} capture', {count: day.snapshotCount}) }}</span></template><template v-else v-html="' '"></template></span></span>
|
<span v-for="(day,i) in days"><br v-if="i && i % 7===0"/><span class="day" :class="{empty: !day || !day.snapshotCount, 'contains-current-snapshot':dayContainsCurrentSnapshot(day)}" :style="dayStyle" @click="gotoDay(day, $event)"><template v-if="day"><span class="size" v-if="day.snapshotCount" :style="getDayCountCircleStyle(day.snapshotCount)"> </span><span class="day-id">{{day.id}}</span><span v-if="day.snapshotCount" class="count">{{ $root._(day.snapshotCount !== 1 ? '{count} captures':'{count} capture', {count: day.snapshotCount}) }}</span></template><template v-else v-html="' '"></template></span></span>
|
||||||
</div>
|
</div>
|
||||||
<div v-else class="empty">no captures</div>
|
<div v-else class="empty">no captures</div>
|
||||||
@ -112,6 +112,9 @@ export default {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
dayInitials() {
|
||||||
|
return PywbI18N.instance.getWeekDays().map(d => d.substr(0,1));
|
||||||
|
},
|
||||||
dayStyle() {
|
dayStyle() {
|
||||||
const s = this.daySize;
|
const s = this.daySize;
|
||||||
return `height: ${s}px; width: ${s}px; line-height: ${s}px`;
|
return `height: ${s}px; width: ${s}px; line-height: ${s}px`;
|
||||||
|
@ -24,6 +24,15 @@ export class PywbI18N {
|
|||||||
getMonth(id, type='long') {
|
getMonth(id, type='long') {
|
||||||
return decodeURIComponent(this.config[PywbI18N.monthIdPrefix[id]+'_'+type]);
|
return decodeURIComponent(this.config[PywbI18N.monthIdPrefix[id]+'_'+type]);
|
||||||
}
|
}
|
||||||
|
// can get long (default) or short day string or intial
|
||||||
|
// PywbI18N expects to receive day's initials like:
|
||||||
|
// config.mon_short, config.tue_long, ...., config.<mmm>_short, config.<mmm>_long
|
||||||
|
getWeekDay(id, type='long') {
|
||||||
|
return decodeURIComponent(this.config[id+'_'+type])
|
||||||
|
}
|
||||||
|
getWeekDays(type='long') {
|
||||||
|
return ['mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun'].map(d => this.getWeekDay(d, type));
|
||||||
|
}
|
||||||
getText(id, embeddedVariableStrings=null) {
|
getText(id, embeddedVariableStrings=null) {
|
||||||
const translated = decodeURIComponent(this.config[id] || id);
|
const translated = decodeURIComponent(this.config[id] || id);
|
||||||
if (embeddedVariableStrings && id.indexOf('{') >= 0 && id.indexOf('}') >= 0 ) {
|
if (embeddedVariableStrings && id.indexOf('{') >= 0 && id.indexOf('}') >= 0 ) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user