I am interested to find good pros and cons on implementing localization based on keys or the actual strings.
With keys, the implementation is a function where the parameter is a key for that string:
translate(DeleteFileConfirmationId)
With actual strings, the implementation is a function where the parameter is the actual string in the default\neutral language:
translate('Are you sure you want to delete the file?')
The issue I see with the latter is if the application needs to display a different element (for example, an image) based on the value returned from the backend, if the value is a string and not a key, it has to check with the string:
if(x === 'Red dragon')
{
displayImage('RedDragon.png');
}
Any other pros and cons?
Aucun commentaire:
Enregistrer un commentaire