Skip to content

Instantly share code, notes, and snippets.

@RomkeVdMeulen
Last active October 12, 2016 10:21
Show Gist options
  • Save RomkeVdMeulen/a81a86d61f776c89c48770729ed65dd7 to your computer and use it in GitHub Desktop.
Save RomkeVdMeulen/a81a86d61f776c89c48770729ed65dd7 to your computer and use it in GitHub Desktop.
export function translation(textkey: string) {
if (!textkey) {
throw "Parameter textkey is required with the @translation decorator";
}
return (target: any, property: string) => {
translationService().getTranslation(textkey)
.then(text => target[property] = text);
}
}
export function translationPromise(textkey: string) {
if (!textkey) {
throw "Parameter textkey is required with the @translationPromise decorator";
}
return (target: any, property: string) => target[property] = textService().getText(textkey);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment