|
|
@ -5,34 +5,34 @@ import { LangPackDifference, LangPackString } from "../layer"; |
|
|
|
import apiManager from "./mtproto/mtprotoworker"; |
|
|
|
import apiManager from "./mtproto/mtprotoworker"; |
|
|
|
import sessionStorage from "./sessionStorage"; |
|
|
|
import sessionStorage from "./sessionStorage"; |
|
|
|
|
|
|
|
|
|
|
|
export const langPack: {[actionType: string]: string} = { |
|
|
|
export const langPack: {[actionType: string]: LangPackKey} = { |
|
|
|
"messageActionChatCreate": "created the group", |
|
|
|
"messageActionChatCreate": "ActionCreateGroup", |
|
|
|
"messageActionChatEditTitle": "changed group name", |
|
|
|
"messageActionChatEditTitle": "ActionChangedTitle", |
|
|
|
"messageActionChatEditPhoto": "changed group photo", |
|
|
|
"messageActionChatEditPhoto": "ActionChangedPhoto", |
|
|
|
"messageActionChatDeletePhoto": "removed group photo", |
|
|
|
"messageActionChatDeletePhoto": "ActionRemovedPhoto", |
|
|
|
"messageActionChatReturn": "returned to group", |
|
|
|
"messageActionChatReturn": "ActionAddUserSelf", |
|
|
|
"messageActionChatJoined": "joined the group", |
|
|
|
"messageActionChatJoined": "ActionAddUserSelfMega", |
|
|
|
"messageActionChatAddUser": "invited {}", |
|
|
|
"messageActionChatAddUser": "ActionAddUser", |
|
|
|
"messageActionChatAddUsers": "invited {} users", |
|
|
|
"messageActionChatAddUsers": "ActionAddUser", |
|
|
|
"messageActionChatLeave": "left the group", |
|
|
|
"messageActionChatLeave": "ActionLeftUser", |
|
|
|
"messageActionChatDeleteUser": "removed user {}", |
|
|
|
"messageActionChatDeleteUser": "ActionKickUser", |
|
|
|
"messageActionChatJoinedByLink": "joined the group via invite link", |
|
|
|
"messageActionChatJoinedByLink": "ActionInviteUser", |
|
|
|
"messageActionPinMessage": "pinned message", |
|
|
|
"messageActionPinMessage": "ActionPinnedNoText", |
|
|
|
"messageActionContactSignUp": "joined Telegram", |
|
|
|
"messageActionContactSignUp": "Chat.Service.PeerJoinedTelegram", |
|
|
|
"messageActionChannelCreate": "Channel created", |
|
|
|
"messageActionChannelCreate": "ActionCreateChannel", |
|
|
|
"messageActionChannelEditTitle": "Channel renamed", |
|
|
|
"messageActionChannelEditTitle": "Chat.Service.Channel.UpdatedTitle", |
|
|
|
"messageActionChannelEditPhoto": "Channel photo updated", |
|
|
|
"messageActionChannelEditPhoto": "Chat.Service.Channel.UpdatedPhoto", |
|
|
|
"messageActionChannelDeletePhoto": "Channel photo removed", |
|
|
|
"messageActionChannelDeletePhoto": "Chat.Service.Channel.RemovedPhoto", |
|
|
|
"messageActionHistoryClear": "History was cleared", |
|
|
|
"messageActionHistoryClear": "HistoryCleared", |
|
|
|
|
|
|
|
|
|
|
|
"messageActionChannelMigrateFrom": "", |
|
|
|
"messageActionChannelMigrateFrom": "ActionMigrateFromGroup", |
|
|
|
|
|
|
|
|
|
|
|
"messageActionPhoneCall.in_ok": "Incoming Call", |
|
|
|
"messageActionPhoneCall.in_ok": "ChatList.Service.Call.incoming", |
|
|
|
"messageActionPhoneCall.out_ok": "Outgoing Call", |
|
|
|
"messageActionPhoneCall.out_ok": "ChatList.Service.Call.outgoing", |
|
|
|
"messageActionPhoneCall.in_missed": "Missed Call", |
|
|
|
"messageActionPhoneCall.in_missed": "ChatList.Service.Call.Missed", |
|
|
|
"messageActionPhoneCall.out_missed": "Cancelled Call", |
|
|
|
"messageActionPhoneCall.out_missed": "ChatList.Service.Call.Cancelled", |
|
|
|
|
|
|
|
|
|
|
|
"messageActionBotAllowed": "You allowed this bot to message you when logged in {}" |
|
|
|
"messageActionBotAllowed": "Chat.Service.BotPermissionAllowed" |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
export type LangPackKey = string | keyof typeof lang; |
|
|
|
export type LangPackKey = string | keyof typeof lang; |
|
|
@ -109,11 +109,11 @@ namespace I18n { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export const polyfillPromise = (function checkIfPolyfillNeeded() { |
|
|
|
export const polyfillPromise = (function checkIfPolyfillNeeded() { |
|
|
|
if(typeof(Intl) !== 'undefined' && typeof(Intl.PluralRules) !== 'undefined' && false) { |
|
|
|
if(typeof(Intl) !== 'undefined' && typeof(Intl.PluralRules) !== 'undefined'/* && false */) { |
|
|
|
return Promise.resolve(); |
|
|
|
return Promise.resolve(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return import('./pluralPolyfill').then(_Intl => { |
|
|
|
return import('./pluralPolyfill').then((_Intl) => { |
|
|
|
(window as any).Intl = _Intl.default; |
|
|
|
(window as any).Intl = Object.assign(typeof(Intl) !== 'undefined' ? Intl : {}, _Intl.default); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
})(); |
|
|
|
})(); |
|
|
@ -167,15 +167,16 @@ namespace I18n { |
|
|
|
.replace(/\*\*(.+?)\*\*/g, '<b>$1</b>'); |
|
|
|
.replace(/\*\*(.+?)\*\*/g, '<b>$1</b>'); |
|
|
|
|
|
|
|
|
|
|
|
if(args?.length) { |
|
|
|
if(args?.length) { |
|
|
|
out = out.replace(/%\d\$.|%./g, (match, offset, string) => { |
|
|
|
let i = 0; |
|
|
|
return '' + args.shift(); |
|
|
|
out = out.replace(/un\d|%\d\$.|%./g, (match, offset, string) => { |
|
|
|
|
|
|
|
return '' + args[i++]; |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return out; |
|
|
|
return out; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const weakMap: WeakMap<HTMLElement, IntlElement> = new WeakMap(); |
|
|
|
export const weakMap: WeakMap<HTMLElement, IntlElement> = new WeakMap(); |
|
|
|
|
|
|
|
|
|
|
|
export type IntlElementOptions = { |
|
|
|
export type IntlElementOptions = { |
|
|
|
element?: HTMLElement, |
|
|
|
element?: HTMLElement, |
|
|
|