Created
September 13, 2020 08:27
-
-
Save onepointconsulting/0e821826897760e06b0d3e2cd121e493 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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