Is there a language code vs locale confusion in Nextcloud (and possibly elsewhere)?
If I select German (informal) as the language setting in my userâs profile, the language code in the oc_preferences table is set to de. If I select German (formal), the language code in the table is set to de_DE.
I didnât know de_DE was a formal language code âŠ
Reading a few threads about this:
and
If I have something that is language context sensitive, Iâd then have to code for de and de_DE as two different languages as Iâm sure that someone who actually wants formal German isnât happy with getting informal German âŠ
The de_DE is a locale, not just language. It consists of first he language code and then the region code. It reads âgerman in Germanyâ.
Other examples would be nn_no which reads ânynorsk in Norwayâ or sv_SE as âswedish in Swedenâ or even sv_US which would be âswedish in the USAâ.
EDIT: I realize this isnât really what you asked. But I would reply that an informal language is one which isnât specific to a certain region, whereas a formal one can be considered to be one that is specific to a certain region.
I urgently need to make a comment here regarding the German language. The German language is currently the only language at Nextcloud that has the luxury of maintaining two variants. On the one hand, there is the formal variant (de_DE) and the informal variant (de). The history of this implementation goes back to the time when Nextcloud was still called ownCloud. I would like to question whether this was a good approach. The whole thing is not carefree either, because on mobile platforms like Android and iOS this causes problems. If you take a look at the Nextcloud project at Transifex, you will see a colourful mix of language abbreviations. This is an addition.
Yeah, this should really be changed. And it does not belong in the âlangâ preference unless specifically documented.
It also makes it somewhat âcomplicatedâ (not really, but âŠ) to manage the return value of a fetch call to get âlangâ preference since you really need to make an exception (or split on underscore). And we all need what happens to hardcoded exceptions in code as it ages.
Well, yes and no. Iâm well aware of the fact that de_DE is a locale, but de is the language code in this particular situation. IMHO, de_DE has no place in a lang preference (in particular since thereâs a completely separate locale setting).
Itâd be a much better solution (again, IMHO) to give developers an advice on how to properly handle this (and for Nextcloud to be changed).
Regardless of how this is âsolvedâ at some point, there should be added documentation to explain this.