Basic support for translated numerals
This commit is contained in:
parent
b1acf7d1f7
commit
5294069b20
2 changed files with 37 additions and 4 deletions
|
|
@ -12,7 +12,7 @@
|
|||
</template>
|
||||
<span>{{ $t("global.click_to_remove") }}</span>
|
||||
</v-tooltip>
|
||||
<v-icon v-else class="ma-1 ml-0 clickable" @click="onClickEmoji(name)">$vuetify.icons.ic_like</v-icon> {{ value.length }}
|
||||
<v-icon v-else class="ma-1 ml-0 clickable" @click="onClickEmoji(name)">$vuetify.icons.ic_like</v-icon> {{ $i18n.toLocalNumbers(value.length.toFixed()) }}
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
|
@ -45,6 +45,7 @@ export default {
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
console.log("I18", this.$i18n.toLocalNumbers);
|
||||
this.reactions = this.timelineSet.relations.getChildEventsForEvent(this.event.getId(), 'm.annotation', 'm.reaction');
|
||||
this.event.on("Event.relationsCreated", this.onRelationsCreated);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ function importAll(r) {
|
|||
}
|
||||
importAll(require.context('@/assets/translations/', true, /\.json$/));
|
||||
|
||||
|
||||
export default new VueI18n({
|
||||
const vue18n = new VueI18n({
|
||||
locale: 'en',
|
||||
fallbackLocale: 'en',
|
||||
silentFallbackWarn: true,
|
||||
|
|
@ -51,4 +50,37 @@ export default new VueI18n({
|
|||
return (choicesLength < 4) ? 2 : 3;
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
vue18n.toLocalNumbers = (str) => {
|
||||
if (vue18n.locale == "my") {
|
||||
// Translate to burmese numerals
|
||||
var result = "";
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
var c = str.charCodeAt(i);
|
||||
if (c >= 48 && c <= 57) {
|
||||
result += String.fromCharCode(c + 0x1040 - 48);
|
||||
} else {
|
||||
result += String.fromCharCode(c);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
} else if (vue18n.locale == "bo") {
|
||||
// Translate to tibetan numerals
|
||||
result = "";
|
||||
for (i = 0; i < str.length; i++) {
|
||||
c = str.charCodeAt(i);
|
||||
if (c >= 48 && c <= 57) {
|
||||
result += String.fromCharCode(c + 0x0f20 - 48);
|
||||
} else {
|
||||
result += String.fromCharCode(c);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
return str;
|
||||
};
|
||||
|
||||
|
||||
export default vue18n;
|
||||
Loading…
Add table
Add a link
Reference in a new issue