PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
but i dont want to give all the different language possibilities, like en, en-au, ...
but there has to be a solution where i cut everythinf after the -, so that for ex en-au would be en
i think it wouldn't give any problems after.
According to RFC 4646, all language subtags are two-letters long. Anyway, there really shouldn't be a need to use substr as long as your exploding with a dash.
aaronhall wrote:According to RFC 4646, all language subtags are two-letters long. Anyway, there really shouldn't be a need to use substr as long as your exploding with a dash.
http://www.w3.org/International/articles/language-tags/Overview.en.php wrote:Most language tags consist of a two- or three-letter language subtag. Sometimes this is followed by a two-letter or three-digit region subtag.
[...] Examples include:
[...] mas Masai language
[...] Now all valid subtags are listed in a single IANA registry, which adopts only one value from the ISO lists per language. If a two-letter ISO code is available, this will be the one in the registry. Otherwise the registry will contain one three-letter code.
strtok can simplify the script to extract the language subtag