I have a legacy/non-django application where I have translation files that are in a different format from Django/gettext .po files. I would like to use all the strings in my Django application, but I would also like to continue using them in the existing application.
The format of the current system is:
- Every language has it's own file. (ie.
en.txt,de.txt,fr.txt) - Each line has a string translated in to it's own language
- When a string is used in application, the line number that matches that string is first found in
en.txtand the same line is returned from the target language. So if the string was "hello world" and on line 5 of en.txt, the function would return line 5 of de.txt which would be "hallo welt".
What is the best way to use the old translation files within Django?
Here are a few ideas I've thought of
- Override the
gettextsystem in Django to return my own translations - Create my own template tags to handle translation
- Create a script to create
.pofiles from the.txtfiles