#24503: Misleading doc regarding language_code fallback
-------------------------------------+-------------------------------------
     Reporter:  pakal                |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:                       |                  Version:  1.7
  Internationalization               |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by pakal):

 * needs_docs:   => 0
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Old description:

> The docs state that LANGUAGE_CODE will be used as fallback if a specific
> string has no translation in the active request language
> (https://docs.djangoproject.com/en/1.7/ref/settings/#language-code).
>
> However, my tests and my exploration of "real_trans.py" suggest that
> LANGUAGE_CODE is only used as a global fallback if the whole selected
> language is missing. Per-string fallback doesn't work it seems, on django
> <=1.7 at least (on current dev branch, lots of stuffs have moved in that
> code, so it seems a real fallback is getting implemented).
>
> Example of a test output:
>
> 2015-03-18_14:48:34 UTC -  INFO - <722724742146458> Language active for
> request: 'de' (LANGUAGE_CODE: 'fr-FR')
>
> Translated string received : "'invalid input parameters'"  (so no
> translation occurred)
>
> When forcing active language to fr or fr-FR, the string is properly
> translated to "Paramètres invalides" in french.
>

> Is that a bug of django, an error in the docs, or an ertror on my side ?
> I may provide a patch to fix django<=1.7 docs, if it occurs that per-
> string language was actually never implemented.

New description:

 The docs state that LANGUAGE_CODE will be used as fallback if a specific
 string has no translation in the active request language
 (https://docs.djangoproject.com/en/1.7/ref/settings/#language-code).

 However, my tests and my exploration of "real_trans.py" suggest that
 LANGUAGE_CODE is only used as a global fallback if the whole selected
 language is missing. Per-string fallback doesn't work it seems, on django
 <=1.7 at least (on current dev branch, lots of stuffs have moved in that
 code, so it seems a real fallback is getting implemented).

 Example of a test output:

 2015-03-18_14:48:34 UTC -  INFO - <722724742146458> Language active for
 request: 'de' (LANGUAGE_CODE: 'fr-FR')

 Translated string received : "'invalid input parameters'"  (so no
 translation occurred)

 When forcing active language to fr or fr-FR, the string is properly
 translated to "Paramètres invalides" in french.


 Is that a bug of django, an error in the docs, or an error on my side ? I
 may provide a patch to fix django<=1.7 docs, if it occurs that per-string
 language fallback was actually never implemented yet.

--

--
Ticket URL: <https://code.djangoproject.com/ticket/24503#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/063.4579d24b79b994c22e504f6c69e00759%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to