Language/locale files using wrong naming convention

Bug #823377 reported by willichan
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Xibo
Fix Released
Low
Dan Garner

Bug Description

Language files (.mo) in the locale folder are currently named using underscores (_) between the language tag and the sub-tag. RFC5646 / BCP47 (as well as earlier documents) specify that a hyphen (-) be used.
http://www.rfc-editor.org/rfc/bcp/bcp47.txt

Since the language detection function directly matches the preferred languages to the language file names, no matches can be made for languages using a sub-tag. This creates issues for users with primary language preferences that have sub-tags, and lesser-priority language preferences that do not have sub-tags.

Language files included with the server need to be renamed to use a hyphen instead of an underscore.

For further information, see Question 166180
https://answers.launchpad.net/xibo/+question/166180

Related branches

Revision history for this message
Alex Harrington (alexharrington) wrote :

They're named that way because that's how Launchpad exports them. It's also how GNU Gettext expects them to be presented as far as I'm aware.

Changed in xibo:
status: New → Opinion
Revision history for this message
willichan (willichan) wrote :

I provided a link to the relative RFC so you can check it for yourself. If you look at the headers that the browsers send, you will also find that they are using hyphens.

Renaming the files to use hyphens fixes the language detection behavior.

If you do not wish to rename the files, you could instead modify the detection code to allow xx-yy to match xx_yy.

Revision history for this message
Alex Harrington (alexharrington) wrote :

I'm not disagreeing with what the RFC says, I'm just pointing out that if they're wrong then they're wrong for every project that translates with Launchpad - which would seem to be unlikely.

Changed in xibo:
status: Opinion → Confirmed
milestone: none → 1.3.0
importance: Undecided → Low
Revision history for this message
willichan (willichan) wrote :

Thank you for clarifying. I have never used Launchpad, so I am not familiar with its conventions.

I took another look at translationengine.class.php. The problem can actually be fixed by simply changing line 78 to

        $lang = str_replace("-", "_",$rawLang[0]);

The function will then match both RFC compliant codes and Launchpad compliant.

Dan Garner (dangarner)
Changed in xibo:
assignee: nobody → Dan Garner (dangarner)
status: Confirmed → Fix Committed
Dan Garner (dangarner)
Changed in xibo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.