Closed Bug 651854 Opened 13 years ago Closed 13 years ago

Group questions and answers together in the PO files

Categories

(Websites :: webifyme.org, defect, P1)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stas, Assigned: chinkle)

References

Details

Attachments

(2 files)

https://github.com/mozilla/webifyme/tree/master/ff4/locale/dbgettext/things has 'quizanswer' and 'quizquestion' as two different directories.

When I extract the strings, xgettext goes through the files directory by directory, so the questions end up lumped together, and so do the answers. 

2 solutions:

- rearrange the files so that the strings are extracted in a more logical order,

- add l10n comments to the answers to indicate which question they correspond to (full text of the question would be best).  See <http://docs.djangoproject.com/en/dev/topics/i18n/internationalization/#comments-for-translators>.

I'm marking this as critical, because right now the PO file looks like a collection of 500+ random strings with no connection to each other.
Assignee: nobody → jbresnik
Austin - we were chatting about this yesterday, what was the solution?
Stas - can you look at this again - we've changed how the questions / answers work now, i.e. may be fine now - if not assign back to me - thanks
Assignee: jbresnik → stas
Having this in one file is an improvement, but I'd like to suggest to go one step further.  As I mentioned, providing context is very important in l10n, so here's two approaches that I think would be worth pursuing:


1. mix questions and answers, by order (preferred):

> { 
>   'question': _(u'It\'s Friday, 4 pm, and you\'re planning your weekend on the Internet. Do you spend your afternoon:'),
>   'answers': {
>       1: _(u'Watching movie trailers and TV show previews.'),
>       2: _(u'Checking out avalanche warnings for your backcountry ski trip.'),
>       3: _(u'Catching up with your friends\' status updates and tweets.'),
>       4: _(u'Emailing yourself work files so you can get more done by Monday.'),
>    }
> }



2. provide ll10n comments:

> QUESTIONS = {1: _(u'It\'s Friday, 4 pm, and you\'re planning your weekend on the Internet. Do you spend your afternoon:'),
>              ...
>             }
> 
> ANSWERS = {
>            # Translators: Question: It's Friday, 4 pm, and you're planning your weekend on the Internet. Do you spend your afternoon:
>            1: _(u'Watching movie trailers and TV show previews.'),
>            # Translators: Question: It's Friday, 4 pm, and you're planning your weekend on the Internet. Do you spend your afternoon:
>            2: _(u'Checking out avalanche warnings for your backcountry ski trip.'),
>            # Translators: Question: It's Friday, 4 pm, and you're planning your weekend on the Internet. Do you spend your afternoon:
>            3: _(u'Catching up with your friends\' status updates and tweets.'),
>            # Translators: Question: It's Friday, 4 pm, and you're planning your weekend on the Internet. Do you spend your afternoon:
>            4: _(u'Emailing yourself work files so you can get more done by Monday.'),
>            ...
>           }

Thoughts?
Priority: -- → P1
Target Milestone: --- → 1.0
brez, any thoughts on comment 3?
Assignee: stas → jbresnik
Yea it's definilty possible but a lot of leg work, and not really technical at all, i.e. anyone could do it.
(In reply to comment #5)
Claudia - can you delegate this to someone at TBG?
Assignee: jbresnik → claudia
I'm working on this.
Assignee: claudia → chinkle
Stas, how should the ANSWERS_BY_IMAGE section be formatted, it's less straightforward.
Assignee: chinkle → stas
Looking for two parts to that, 1.) If it's necessary, and 2.) If so, how should it be formatted. 

Questions and Answers sections are reformatted as you prefer in option 1, not committed in yet.
Our typical workflow is to take a stab at it, then attach your diff for code review.

cd top of repo
git diff > bug651854.diff
This Bug > Attachments > Add an Attachment
check patch
Set review '?' :stas, :gandlaf

Thanks for your help Chris!
Gandalf - can you review the coming patch and give guidance on the other half of the patch?
Attached patch patchSplinter Review
Comment on attachment 532777 [details] [diff] [review]
patch

that patch looks good.

I'd still add the comments because localizers will not see the questions at the time when they'll be localizing answers.

I'm not sure what are the other parts I'm supposed to look at. What are the answers by image?
Attachment #532777 - Flags: review+
Great. 

What do you mean by comments? I thought the inline approach was preferred. I can add comments to the inline approach if you think it will help. 

Gandalf, ANSWERS_BY_IMAGE represents some copy shown to the user depending on their answer. The list is also de-normalized, as the same copy can be used in multiple places. So, to provide context I could reference the object represented by the answer, or as the question and answer, or all three.
(In reply to comment #14)
Can you give url pointers into github original code, which you wanted input on how to re-order the strings?

I think gandalf is missing context, since he just walked into this bug. So pointers to the other half that needs reorganizing will be good.

Thanks again Chris!
Chris: if that's not too much work, that would add a value to localizers.

To give you example, that's how a localizer sees each string: https://localize.mozilla.org/it/webowonder/LC_MESSAGES/messages.po/translate/?page=7

It's not that easy to see which question the answer belongs to. If it's easy for you (some macro hopefully), that would help.

As Ozten said, I could use some url to the other questions to evaluate them
Attached patch patchSplinter Review
Gandalf, Stas, please check out this diff with comments inserted to give context to ANSWERS_BY_IMAGE
Attachment #533381 - Flags: review+
Attachment #533381 - Flags: review?(gandalf)
Attachment #533381 - Flags: review+ → review?(stas)
Comment on attachment 533381 [details] [diff] [review]
patch

Apparently this patch already landed in https://github.com/mozilla/webifyme/commit/63e7aa6c71d31c2bdbe793557dbbd0b80cdc67da.

The comments look great and will be very helpful for the localizers.  Thanks!

However, I'm going to r- it to make sure my feedback below is addressed.  Please attach a new patch diff'ed against the commit above.


>@ -1,358 +1,1500 @@
> # -*- coding: utf-8 -*-
>-from tower import ugettext_lazy as _
>+#from tower import ugettext_lazy as _
>
>+def _( string ):
>+    return string

I'm assuming this is some temporary code used for testing.  Can you revert to 'from tower import ugettext_lazy as _'?


>+ANSWERS_BY_IMAGE = {
>+
>+# Question: It's Friday, 4 pm, and you're planning your weekend on the Internet. Do you spend your afternoon:
>+# Answer: Watching movie trailers and TV show previews.
>+# Image: Fortune - 1755_site_0057.png
>+1: _(u'One symbol stands above all others as the authority - wise, unquestionable, and universally fair. Want the truth? Look to The Cookie - The Cookie tells all.')
>+,

In order for the comments to be picked up by the extraction script, you will need to prefix each line with a spacial keyword.  The actual keyword depends on the tools that we use:

- if we use regular django i18n support, the keyword is "Translators: "
- if we use tower, the keyword is "L10n: "

Using tower alone is being discussed in bug 656789.  It's also part of Playdoh (bug 656793).

An example of how to use tower's "L10n: " keyword would be:

>+ANSWERS_BY_IMAGE = {
>+
>+# L10n: Question: It's Friday, 4 pm, and you're planning your weekend on the Internet. Do you spend your afternoon:
>+# L10n: Answer: Watching movie trailers and TV show previews.
>+# L10n: Image: Fortune - 1755_site_0057.png
>+1: _(u'One symbol stands above all others as the authority - wise, unquestionable, and universally fair. Want the truth? Look to The Cookie - The Cookie tells all.')
>+,
Attachment #533381 - Flags: review?(stas)
Attachment #533381 - Flags: review?(gandalf)
Attachment #533381 - Flags: review-
I can make those changes, just need to know which keyword you want to use.
Thanks Chris.  I'll get back to you once we have a final decision regarding the keyword.
(In reply to comment #20)
Please use tower keyword.
Assignee: stas → chinkle
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → INVALID
Resolution: INVALID → WORKSFORME
Resolution: WORKSFORME → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: