Merge pull request #3519 from jrsupplee/issue-2074

Hopeful fix for i18n not working in `onRendered()`
This commit is contained in:
Lauri Ojansivu 2021-02-02 18:07:25 +02:00 committed by GitHub
commit 76ef6a81ab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 42 additions and 31 deletions

View file

@ -78,12 +78,10 @@ BlazeComponent.extendComponent({
onRendered() {
Meteor.subscribe('setting');
this.colorMap = {};
for (const color of Boards.simpleSchema()._schema['labels.$.color']
.allowedValues) {
this.colorMap[TAPi18n.__(`color-${color}`)] = color;
}
// // eslint-disable-next-line no-console
// eslint-disable-next-line no-console
console.log('lang:', TAPi18n.getLanguage());
this.colorMap = Boards.colorMap();
// eslint-disable-next-line no-console
// console.log('colorMap:', this.colorMap);
if (Session.get('globalQuery')) {
@ -296,13 +294,14 @@ BlazeComponent.extendComponent({
if (m.groups.operator) {
op = m.groups.operator.toLowerCase();
} else {
op = m.groups.abbrev;
op = m.groups.abbrev.toLowerCase();
}
if (operatorMap.hasOwnProperty(op)) {
let value = m.groups.value;
if (operatorMap[op] === 'labels') {
if (value in this.colorMap) {
value = this.colorMap[value];
// console.log('found color:', value);
}
} else if (
['dueAt', 'createdAt', 'modifiedAt'].includes(operatorMap[op])
@ -388,7 +387,7 @@ BlazeComponent.extendComponent({
params.text = text;
// eslint-disable-next-line no-console
// console.log('params:', params);
console.log('params:', params);
this.queryParams = params;