Updated translations
This commit is contained in:
parent
e3eddd6b85
commit
91b4197b04
5 changed files with 68 additions and 7 deletions
|
|
@ -36,7 +36,7 @@ const schemaUser = new SimpleSchema({
|
|||
emails: {
|
||||
type: Array,
|
||||
min: 1,
|
||||
label() { return i18n.t('Lista de emails de contacto'); },
|
||||
// label() { return i18n.t('Lista de emails de contacto'); },
|
||||
// For accounts-password, either emails or username is required,
|
||||
// but not both.
|
||||
// It is OK to make this optional here because the accounts-password
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import i18n from 'i18next';
|
||||
import getPrivateFile from '../../../modules/server/get-private-file';
|
||||
import parseMarkdown from '../../../modules/parse-markdown';
|
||||
|
||||
|
|
@ -8,4 +9,11 @@ Meteor.methods({
|
|||
check(fileName, String);
|
||||
return parseMarkdown(getPrivateFile(`pages/${fileName}.md`));
|
||||
},
|
||||
'utility.saveMissingI18n': function saveMissing(key, value) {
|
||||
check(key, String);
|
||||
check(value, String);
|
||||
if (!Meteor.isProduction) {
|
||||
i18n.t(key, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
/* global CookieConsent Intl */
|
||||
import i18n from 'i18next';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import backend from 'i18next-xhr-backend';
|
||||
import LngDetector from 'i18next-browser-languagedetector';
|
||||
import Cache from 'i18next-localstorage-cache';
|
||||
|
|
@ -48,6 +49,15 @@ i18nOpts.react = {
|
|||
nsMode: 'default' */
|
||||
};
|
||||
|
||||
const sendMissing = false;
|
||||
if (sendMissing && !Meteor.isProduction) {
|
||||
i18nOpts.sendMissing = true;
|
||||
i18nOpts.sendMissingTo = 'fallback';
|
||||
i18nOpts.missingKeyHandler = function miss(lng, ns, key, defaultValue, lngs) {
|
||||
Meteor.call('utility.saveMissingI18n', key, defaultValue);
|
||||
};
|
||||
}
|
||||
|
||||
i18n.use(backend)
|
||||
.use(LngDetector)
|
||||
.use(Cache)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import moment from 'moment';
|
|||
import es from 'meteor-accounts-t9n/build/es';
|
||||
import en from 'meteor-accounts-t9n/build/en';
|
||||
|
||||
var backOpts = {
|
||||
const backOpts = {
|
||||
// path where resources get loaded from
|
||||
loadPath: '/locales/{{lng}}/{{ns}}.json',
|
||||
|
||||
|
|
@ -15,10 +15,10 @@ var backOpts = {
|
|||
jsonIndent: 2
|
||||
};
|
||||
|
||||
const forceDebug = false;
|
||||
const forceDebug = true;
|
||||
const shouldDebug = (forceDebug && !Meteor.isProduction);
|
||||
|
||||
var i18nOpts = {
|
||||
const i18nOpts = {
|
||||
backend: backOpts,
|
||||
lng: 'es',
|
||||
// fallbackLng: 'es',
|
||||
|
|
@ -26,12 +26,12 @@ var i18nOpts = {
|
|||
'en-US': ['en'],
|
||||
'en-GB': ['en'],
|
||||
'pt-BR': ['pt'],
|
||||
'default': ['es']
|
||||
default: ['es']
|
||||
},
|
||||
interpolation: {
|
||||
escapeValue: false, // not needed for react!!
|
||||
formatSeparator: ',',
|
||||
format: function (value, format, lng) {
|
||||
format: function f(value, format, lng) {
|
||||
// https://www.i18next.com/formatting.html
|
||||
// console.log(`Value: ${value} with format: ${format} to lang: ${lng}`);
|
||||
if (format === 'uppercase') return value.toUpperCase();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue