django-rosetta icon indicating copy to clipboard operation
django-rosetta copied to clipboard

any chance of using Rosetta to *add* new strings?

Open michaelgeary opened this issue 11 years ago • 5 comments

it seems that it is reading/writing the .po file anyways. Would it be a bad idea to let Rosetta add new terms?

michaelgeary avatar Jun 19 '13 23:06 michaelgeary

How would you match new terms with any string of your application ?

Glideh avatar Dec 23 '13 10:12 Glideh

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.

generalov avatar Sep 24 '14 13:09 generalov

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?

MattijnLahuis avatar Apr 15 '15 11:04 MattijnLahuis

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:

  1. Create a file named strings.py somewhere in your Django project:

    > $EDITOR strings.py
    
  2. Add custom strings wrapped with ugettext_noop:

    from django.utils.translation import ugettext_noop as _
    
    _('Custom String 1')
    _('Custom String 2')
    
  3. Create *.po files:

    > python manage.py makemessages --all
    
  4. Custom strings are included in locale files:

    captura de pantalla 2015-07-15 a las 15 35 39

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.

todofixthis avatar Jul 15 '15 20:07 todofixthis

+3 years later, was this ever implemented in django-rosetta?

psanlorenzo avatar Oct 15 '18 10:10 psanlorenzo