django-rosetta
django-rosetta copied to clipboard
any chance of using Rosetta to *add* new strings?
it seems that it is reading/writing the .po file anyways. Would it be a bad idea to let Rosetta add new terms?
How would you match new terms with any string of your application ?
It should be useful to use django-rosetta as a web-based interface to generate and translate *.po files for external projects (which does not shares the same code base).
We use Django as admin interface (CMS) and API provider for AngularJS SPA (which uses gettext https://angular-gettext.rocketeer.be/). These projects are developed independently of each other. It should be useful to have ability to upload *.po files (new or update existing) to django-rosetta, translate and download translations.
I would like to second generalov's comment. We have the same issue/feature request(?): We use angular-gettext to generate po(t) files and would love to be able to add strings to an existing po file in Rosetta. Any chance a solution will become available soon?
Here is a potential workaround that might help you accomplish what you are looking for, although it still requires making changes to Python code files.
- Use
django.utils.translation.ugettext_noop
to mark strings as translatable without actually translating them (see https://docs.djangoproject.com/en/1.8/topics/i18n/translation/#marking-strings-as-no-op for more information). - Or put all of your custom strings in a file that never gets used anywhere;
makemessages
will still find and parse it. - Or all of the above.
For example:
-
Create a file named
strings.py
somewhere in your Django project:> $EDITOR strings.py
-
Add custom strings wrapped with
ugettext_noop
:from django.utils.translation import ugettext_noop as _ _('Custom String 1') _('Custom String 2')
-
Create
*.po
files:> python manage.py makemessages --all
-
Custom strings are included in locale files:
If desired, you could have an app – such as django-rosetta, perhaps (: – provide an interface for adding/removing strings defined in the file you created.
+3 years later, was this ever implemented in django-rosetta?