mirror of
https://github.com/wekan/wekan.git
synced 2025-12-16 15:30:13 +01:00
Fixed showing translations always, regardsless of is ROOT_URL set correctly or not.
Thanks to xet7 !
This commit is contained in:
parent
f8ee929cf7
commit
1a7bd65e59
3 changed files with 25 additions and 4 deletions
|
|
@ -4,5 +4,20 @@ import { TAPi18n } from './tap';
|
||||||
Blaze.registerHelper('_', (...args) => {
|
Blaze.registerHelper('_', (...args) => {
|
||||||
const { hash } = args.pop();
|
const { hash } = args.pop();
|
||||||
const [key] = args.splice(0, 1);
|
const [key] = args.splice(0, 1);
|
||||||
return TAPi18n.__(key, { ...hash, sprintf: args });
|
|
||||||
|
// If TAPi18n is not initialized yet, return the key as fallback
|
||||||
|
if (!TAPi18n.i18n) {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
const translation = TAPi18n.__(key, { ...hash, sprintf: args });
|
||||||
|
|
||||||
|
// If translation is the same as key (meaning not found), return a formatted version
|
||||||
|
if (translation === key) {
|
||||||
|
return key.split('-').map(word =>
|
||||||
|
word.charAt(0).toUpperCase() + word.slice(1)
|
||||||
|
).join(' ');
|
||||||
|
}
|
||||||
|
|
||||||
|
return translation;
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ if (Meteor.isClient) {
|
||||||
|
|
||||||
export { TAPi18n };
|
export { TAPi18n };
|
||||||
|
|
||||||
(async () => {
|
// Initialize translations immediately and synchronously
|
||||||
|
Meteor.startup(async () => {
|
||||||
await TAPi18n.init();
|
await TAPi18n.init();
|
||||||
})();
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,15 @@ Meteor.publish('activities', (kind, id, limit, showActivities) => {
|
||||||
return ['board', 'card'].indexOf(x) !== -1;
|
return ['board', 'card'].indexOf(x) !== -1;
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
check(id, String);
|
check(id, Match.Maybe(String));
|
||||||
check(limit, Number);
|
check(limit, Number);
|
||||||
check(showActivities, Boolean);
|
check(showActivities, Boolean);
|
||||||
|
|
||||||
|
// Return empty cursor if id is null or undefined
|
||||||
|
if (!id) {
|
||||||
|
return this.ready();
|
||||||
|
}
|
||||||
|
|
||||||
// Get linkedBoard
|
// Get linkedBoard
|
||||||
let linkedElmtId = [id];
|
let linkedElmtId = [id];
|
||||||
if (kind == 'board') {
|
if (kind == 'board') {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue