I was given a task to implement a localization for the whole mobile app on react native with i18next, react localize.
There is a lot of text in many files and so far the only way is to do it manually. Search through the files and then replace the text with the corresponding t reference to the translation file.
Is there actually another way of doing it faster and more convenient?
I made changes in quite many files to the moment. Sometimes thinking if there is a better way to optimize this process.
CodePudding user response:
If by chance your original language isn't English - You can search for characters in that language (using a regex). That will surface all the strings that are user facing (otherwise the code is in English).
Aside from that, I think regex's are your friend. You can search for ".*?" and similar to catch strings.
If you already have a translation file, then you could write a simple script that pulls a translated string, searches for it in project source files, and replaces the occurence with the t()
equivalent.
Hope this helps