Skip to content

Instantly share code, notes, and snippets.

@onepointconsulting
Created September 13, 2020 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save onepointconsulting/0e821826897760e06b0d3e2cd121e493 to your computer and use it in GitHub Desktop.
Save onepointconsulting/0e821826897760e06b0d3e2cd121e493 to your computer and use it in GitHub Desktop.
export function useTranslation() {
return {
t: function (key, extraObj) {
if(arguments.length === 1) {
return langResources[extractParameterSimple('language', 'en-US')]
.translations[key] || key;
}
else {
// TODO: handle the extra object
return langResources[extractParameterSimple('language', 'en-US')]
.translations[`${key}_plural`] || key;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment