Use matrix-doc for SAS emoji translations
This is done through the js-sdk's new SASEmojiV1 class.
This commit is contained in:
parent
c91fc99d4b
commit
d9e7253561
49 changed files with 20 additions and 3524 deletions
|
@ -27,6 +27,7 @@ import PlatformPeg from "./PlatformPeg";
|
|||
// @ts-ignore - $webapp is a webpack resolve alias pointing to the output directory, see webpack config
|
||||
import webpackLangJsonUrl from "$webapp/i18n/languages.json";
|
||||
import { SettingLevel } from "./settings/SettingLevel";
|
||||
import { SASEmojiV1 } from "matrix-js-sdk/src/crypto/verification/SASEmojiV1";
|
||||
|
||||
const i18nFolder = 'i18n/';
|
||||
|
||||
|
@ -39,6 +40,14 @@ counterpart.setSeparator('|');
|
|||
// Fall back to English
|
||||
counterpart.setFallbackLocale('en');
|
||||
|
||||
for (const emoji of SASEmojiV1.getAllEmoji()) {
|
||||
const translations = SASEmojiV1.getTranslationsFor(emoji);
|
||||
for (const lang of Object.keys(translations)) {
|
||||
const tempObject = {[SASEmojiV1.getNameFor(emoji)]: translations[lang]};
|
||||
counterpart.registerTranslations(lang, tempObject);
|
||||
}
|
||||
}
|
||||
|
||||
interface ITranslatableError extends Error {
|
||||
translatedMessage: string;
|
||||
}
|
||||
|
@ -144,6 +153,11 @@ export function _t(text: string, variables?: IVariables, tags?: Tags): string |
|
|||
}
|
||||
}
|
||||
|
||||
export function _tSasV1(emoji: string): string | React.ReactNode {
|
||||
const name = SASEmojiV1.getNameFor(emoji);
|
||||
return _t(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* Similar to _t(), except only does substitutions, and no translation
|
||||
* @param {string} text The text, e.g "click <a>here</a> now to %(foo)s".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue