ojii / django-multilingual-ng

THIS PROJECT IS *NOT* SUPPORTED AND SHOULD NOT BE USED UNLESS YOU KNOW EXACTLY WHAT YOU'RE DOING!!!

Home Page:https://github.com/KristianOellegaard/django-hvad

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

language_code field is too small

nesh opened this issue · comments

Probably just a edge case but 5 character limit on language_code is too small for a variant of my language (st_Latn).

The language_code field complies with ISO standards which uses 2 or 5 character language codes. Thus longer language codes will not be supported by mulitlingual-ng. The language codes are the same as used everywhere else in django, therefore using none-iso language codes won't work anyway.

Check django translation dir sR_Latn (st was typo :)) is allowed and used there and is accepted as official code also in some unix distros I used.

It's varchar db field anyway so few chars more won't make any difference.

Can't check ATM but Win7 at least use similar codes too except that him uses new ISO designation so is RS and RS_LATN iirc.

Anyway still trying to track down why sometimes I can't get translations saved to database from admin and getting no default translations - probably I'm doing something wrong :)

The point is that it's the main index used to look up stuff, so I really want to keep it as small as possible. Anyway if you can find out what the actual maximum length for a language code is, please tell me (with a source).

Is there any reason why you can't just use 'sr'?

sr is reserved for cyrillic translation so I can't just use sr without changing Django locale dir.

As for docs ... found lots of links where this code is used like

http://www.iana.org/assignments/lang-tags/sr-Latn
http://unicode.org/mail-arch/unicode-ml/y2005-m03/0337.html

I'm not sure that there is standard but adding 2 chars to field will hardly make difference. Not a big deal one alter table can fix it anyway :)

well if I start adding chars now I can as well do it right, could you find any RFC/ISO on the max length of those language codes? (at least of the approved/non-private ones?).

Great mess about that ... best I managed to find is RFC1766 (http://www.ietf.org/rfc/rfc1766.txt) - 2x8 chr codes.

Mozilla wiki - https://wiki.mozilla.org/L10n:Locale_Codes goes even further adding more stuff.

I read RFC 1766 as well, but I couldn't find a real 'limit' there. I'll up it to probably 20 or so in my next commit.

doing some maths I came up with 15 as the maximum and I'm gonna run with that