Opened 6 years ago

Closed 6 years ago

#922 closed defect (fixed)

Some strings are not translatable

Reported by: Laura Arjona Reina Owned by:
Priority: major Milestone: 0.8.0
Component: programming Keywords: i18n
Cc: Parent Tickets:


Congratulations for your work in GNU MediaGoblin.

I have setup my testing environment and I saw some strings that were not translated, and they weren't in the .po files.
I grep'ed the source code and made them translatable, and pushed my changes to the i18n branch in my clone:

The general repo is here:

Maybe there are more, but I'm not sure how to generate the new PO files, and how to generate the binary .mo files once the PO files are translated, and which order to give gmg to use the updated .mo files.

If you tell me the commands, I can work on this issue until July 27th. After that, I will be far away from my computer, so if you consider to merge this, please wait until July 28th, if possible (I would git rebase with squash all my work in these days so the git history keeps being elegant and so).


Change History (6)

comment:1 Changed 6 years ago by Christopher Allan Webber

Sure... generating the .po files and the .mo files separately is not too hard once you have a dev instance up and running. You can look at what I do every time I do a translations update by checking out the script at devtools/

But here's the important lines:

# Generate the .po files
./bin/pybabel extract -F babel.ini -o mediagoblin/i18n/en/LC_MESSAGES/mediagoblin.po .
# compile them into .mo files
./bin/pybabel compile -D mediagoblin -d mediagoblin/i18n/

Happy to speak more, on IRC if that's best!

comment:2 Changed 6 years ago by Laura Arjona Reina

I have made some strings translatable in different files. I fixed a quotation mark in an English string, too.
I'm not so sure that rebasing all my changes in one commit is a good idea, since they touch different areas and maybe some of them are not a good idea because they affect the database or other parts of the code.

The current status:

Some questions arised:

  • The timesince strings (3 days ago, 26 minutes ago etc) are not translated (well "ago" is translated, but not the words "day", "minutes", "hours"...) and I'm not sure how to make them translatable.
  • I'm not sure if I can make translatable licenses names and abbreviations. If only the URI is stored in the database, I suppose it's safe to make abbreviations and names translatable in file. But maybe this is safe only with "All rights reserved" and "Public Domain", since for example, CC licenses have different URI for the Unported/International and the Spanish one, so translating the name can be confusing (unless we add Unported/international to the name).
  • I think that user privileges are not translatable. These strings even I cannot find the file or piece of code where they are defined, I only saw some of them in mediagoblin.ini, so I suppose they are not translatable since they are stored "as is" in the database.

That's all for now!

comment:3 Changed 6 years ago by Christopher Allan Webber

Owner: set to Laura Arjona Reina
Status: newin_progress

Okay, I merged your branch larjona! This looks great. Stellar work on your first submission via git! :)

There's one thing that I think we should talk about; it ties into the "timesince" strings, but also part of the code itself. Just to highlight part of your commit (though the problem was already there):

modified   mediagoblin/plugins/archivalook/templates/archivalook/root.html
@@ -61,7 +61,7 @@
       <h2>{% trans %}Nothing is currently featured.{% endtrans %}</h2>
       {% trans %}If you would like to feature a
         piece of media, go to that media entry's homepage and click the button
-        that says{% endtrans %} <a class="button_action">Feature</a>.
+        that says{% endtrans %} <a class="button_action">{% trans %}Feature{% endtrans %}</a>.
       {% trans %}You're seeing this page because you are a user capable of
         featuring media, a regular user would see a blank page, so be sure to
         have media featured as long as your instance has the 'archivalook'

See how there's part of q uestion that's being tacked on at the end? I changed this in a recent commit, but part of attaching together separate translations is that with different language syntax it might not be possible to build a correct translation.

Regarding the timesince, Babel provides a feature for this I think... I would need to look into it.

As for the other issues, let's talk when you get back. I think we got enough in here for 0.7.0, and we can look into addressing the other issues for 0.8.0 or whatever is next.

Assigning back to you. Thanks Laura! Stellar work so far!

comment:4 Changed 6 years ago by Laura Arjona Reina

Sorry but I don't understand your last comment in this issue.

Could it be that you posted an unrelated piece of code? I don't see any timesince related string there, so I cannot understand what you mean.


comment:5 Changed 6 years ago by Christopher Allan Webber

What I meant here is a problem that I think is called "lego translations" (which I can't find the real term for). This basically means if you do:

translate("This is licensed under the ") + translate(license_name) + " " translate("license.")

The developer in the above example has the goal of reusing a license name, which is also translatable. The problem though is that it assumes English grammar structure... you can't be sure that you can put license_name at that location in all language grammars. That exists in a number of places in our code, including the above patch, so I was making you aware.

The point about the "timesince" string is that it provides a similar sentence with individual word substitutions, and I think we might need to think about how to fix that. I have an idea if you're willing to talk it over.

If you have some time and want to ping me on IRC, I can clarify things if the above is unclear, or anything else.

Sorry about the long delay on replying here..

comment:6 Changed 6 years ago by Christopher Allan Webber

Owner: Laura Arjona Reina deleted
Resolution: fixed
Status: in_progressclosed

Since this was merged, I think it's okay to close.

Note: See TracTickets for help on using tickets.