|
|
|
@ -1,3 +1,6 @@
@@ -1,3 +1,6 @@
|
|
|
|
|
import { LangPackString } from "../layer"; |
|
|
|
|
import apiManager from "./mtproto/mtprotoworker"; |
|
|
|
|
|
|
|
|
|
export const langPack: {[actionType: string]: string} = { |
|
|
|
|
"messageActionChatCreate": "created the group", |
|
|
|
|
"messageActionChatEditTitle": "changed group name", |
|
|
|
@ -27,3 +30,25 @@ export const langPack: {[actionType: string]: string} = {
@@ -27,3 +30,25 @@ export const langPack: {[actionType: string]: string} = {
|
|
|
|
|
|
|
|
|
|
"messageActionBotAllowed": "You allowed this bot to message you when logged in {}" |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
export namespace Internationalization { |
|
|
|
|
let strings: {[key: string]: LangPackString} = {}; |
|
|
|
|
|
|
|
|
|
export function getLangPack(langCode: string) { |
|
|
|
|
return apiManager.invokeApi('langpack.getLangPack', { |
|
|
|
|
lang_code: langCode, |
|
|
|
|
lang_pack: 'macos' |
|
|
|
|
}).then(langPack => { |
|
|
|
|
strings = {}; |
|
|
|
|
for(const string of langPack.strings) { |
|
|
|
|
strings[string.key] = string; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
export function _(key: keyof typeof strings, ...args: any[]) { |
|
|
|
|
let str = strings[key]; |
|
|
|
|
|
|
|
|
|
return str; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|