ngx-translate-router
ngx-translate-router copied to clipboard
Allow prefix to be an array to search in multiple places
For the application I am working on I need multiple types of values to be translated. To keep order in my translations file. I'd like to use multiple prefixes to search in different places for my translation.
Example (dutch);
{
"routes": {
"about": "over-ons"
},
"categories": {
"bananas": "bananen"
}
}
When prefixes set to ["routes.", "categories."]
I will allow the translate parser to search for both predefined routes & categories.
Hello @jurienhamaker, Thank you for your PR. If I undersand you don't want to use sub keys like :
{
"routes": {
"about": "over-ons",
"categories": {
"bananas": "bananen"
}
}
}
What you want the library do if it find multiple values ? (Actually you PR stop to first one)
{
"routes": {
"about": "over-ons"
}
"categories": {
"about": "bananen"
}
}
I think it will open the door to multiple usage mistake.
I use the data for such categories for multiple things (not just routes), it would be a very easy mistake to update one value and forget the other if we we're to ever change the values.
For that purpose we want one source of truth for those translations.
I am not sure what I would want the library to do if there are multiple values. I could warn the user that multiple entries were found (and not break) and use the first one., but that would also be an issue to performance (iterating more than you have to).
Alright, I will merge this soon. What Angular version do you actually use ?
Latest stable.