forked from MapComplete/MapComplete
More tests
This commit is contained in:
parent
50d383279d
commit
074782c1e0
6 changed files with 52 additions and 56 deletions
|
@ -43,6 +43,14 @@ export default class Translations {
|
|||
return new Translation(t, context);
|
||||
}
|
||||
|
||||
/**
|
||||
* 'Wrap Translation': given an object containing translations OR a string, returns a translation object
|
||||
*
|
||||
* const json: any = {"en": "English", "nl": "Nederlands"};
|
||||
* const translation = Translations.WT(new Translation(json));
|
||||
* translation.textFor("en") // => "English"
|
||||
* translation.textFor("nl") // => "Nederlands"
|
||||
*/
|
||||
public static WT(s: string | Translation): Translation {
|
||||
if (s === undefined || s === null) {
|
||||
return undefined;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue