Merge pull request #1629 from thecodingmachine/translator

Translator: i18n
This commit is contained in:
Alexis Faizeau
2022-01-25 09:48:48 +01:00
committed by GitHub
83 changed files with 1438 additions and 307 deletions
+15
View File
@@ -13,6 +13,12 @@ export const setPlayerName = (name: string) => {
playerName = name;
};
let playerLanguage: string | undefined;
export const setPlayerLanguage = (language: string | undefined) => {
playerLanguage = language;
};
let tags: string[] | undefined;
export const setTags = (_tags: string[]) => {
@@ -61,6 +67,15 @@ export class WorkadventurePlayerCommands extends IframeApiContribution<Workadven
return playerName;
}
get language(): string {
if (playerLanguage === undefined) {
throw new Error(
"Player language not initialized yet. You should call WA.player.language within a WA.onInit callback."
);
}
return playerLanguage;
}
get tags(): string[] {
if (tags === undefined) {
throw new Error("Tags not initialized yet. You should call WA.player.tags within a WA.onInit callback.");