Commit 55d1add7 by Vladislav Lagunov

[gettext] Поменяны местами аргументы в gettext

parent b4fc2890
...@@ -14,7 +14,7 @@ export type ES6Module<T> = { default: T }; ...@@ -14,7 +14,7 @@ export type ES6Module<T> = { default: T };
// Хелпер для перевода // Хелпер для перевода
export type Gettext = (singular_key: string, context?: string, plural_key?: string, val?: number) => string; export type Gettext = (singular_key: string, plural_key?: string, context?: string, val?: number) => string;
export type I18nString = (locale?: string|LocaleCtx|null) => string; export type I18nString = (locale?: string|LocaleCtx|null) => string;
...@@ -39,7 +39,7 @@ export class Translations { ...@@ -39,7 +39,7 @@ export class Translations {
} }
} }
__: (singular_key: string, context?: string, plural_key?: string, n?: number) => I18nString = (singular_key, context?, plural_key?, n?) => { __: (singular_key: string, plural_key?: string, context?: string, n?: number) => I18nString = (singular_key, plural_key?, context?, n?) => {
return localeOrCtx => { return localeOrCtx => {
let locale = !localeOrCtx ? 'en-US' : typeof(localeOrCtx) === 'string' ? localeOrCtx : localeOrCtx.locale; let locale = !localeOrCtx ? 'en-US' : typeof(localeOrCtx) === 'string' ? localeOrCtx : localeOrCtx.locale;
locale = locale.replace(/_/, '-'); locale = locale.replace(/_/, '-');
...@@ -129,6 +129,7 @@ function assignData(dst: TranslationsData, ...srcs: POData[]): TranslationsData ...@@ -129,6 +129,7 @@ function assignData(dst: TranslationsData, ...srcs: POData[]): TranslationsData
*/ */
export function sprintf(format: string, ...args: any[]): string { export function sprintf(format: string, ...args: any[]): string {
var i = 0; var i = 0;
if (!format) debugger;
return format.replace(/%(s|d)/g, function() { return format.replace(/%(s|d)/g, function() {
return args[i++]; return args[i++];
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment