Fork me on GitHub
Subscribe 5

Ticket #595 (fixed enhancement)

Change languages to codes

  • Created: 2012-01-14 16:28:58
  • Reported by: Reines
  • Assigned to: Franz
  • Milestone: 2.0-alpha1
  • Component: localization
  • Priority: normal

Language packs should be changed to be named after their locale (what is the standard name for these codes?).


English -> en_gb // and/or en_us
German -> de
French -> fr


Franz 2012-01-16 00:31:50

Wouldn't they look somewhat like

en_US, en_GB

Franz 2012-02-15 16:41:01

How should we store their full names, though? One way is adding them to the English language pack (which will only work if we decide to include language packs in core).

Other than that, we would have to add an extra file to every language pack or something like that.

Franz 2012-04-08 11:35:43

I just reverted changing this again yesterday. The reasoning is that we obviously want to display the full name of the language when the user is supposed to make a choice between them (install/profile/options).

Some solutions are provided above, but they're too complex. I would suggest simply putting the locale code in an extra string in the language pack. Solves both problems.


Studio384 2012-04-28 07:27:49

Why change something that already works verry good? As reas here: it make the thing only more difficult.

arw 2012-04-28 13:25:16

there is already lang identifier ( $lang_common['lang_identifier'] for xml:lang="en" lang="en" ) here it will just be inversed ( name of language in the pack and identifier naming the pack ) )

this order enable for example :

- to be sure to reach the language ( if it exists ), for example english could be "en" then if we want to check the english translation, we get the en language ( otherweise it could be named English, english, english language, ... )
- to access easily to file, for example I have a folder "한국어" for korean language, I must copy paste it to be able to enter in it ( sometimes on a server you don't have a mouse ), having identifier as name is more flexible.
- to get guest language ( by browser ) and being able to get the pack ( if exist ), now you have to modify the script and directory to change a language name

Reines 2012-04-28 14:11:13

Yeah they should be stored named after their code - this prevents weird character issues on filesystems without utf8 support, and potentially other such issues - and is generally just more clean feeling. The language name can be stored somewhere inside the pack - potentially in a separate file with meta data?

This means we need to loop through all packs to generate a mapping of code -> name, but that isn't hard, and the mapping can then be cached and only regenerated if we attempt to find the name for a code that we don't have a mapping for.

Franz 2012-05-23 21:51:14

  • Owner set to Franz.

I did this now, although I'm not sure about the names for the code yet. Also, the values in the database need to be updated by hand right now.

Franz 2012-07-07 19:39:21

Great, Laravel already uses codes by default. smile

Franz 2012-08-01 19:58:58

  • Status changed from open to fixed.