[Tickets #15081] Language codes get falsely trimmed two two letters

noreply at bugs.horde.org noreply at bugs.horde.org
Fri Dec 17 15:47:55 UTC 2021


BITTE NICHT AUF DIESE NACHRICHT ANTWORTEN. NACHRICHTEN AN DIESE  
E-MAIL-ADRESSE WERDEN NICHT GELESEN.

Ticket-URL: https://bugs.horde.org/ticket/15081
------------------------------------------------------------------------------
  Ticket           | 15081
  Erstellt Von     | me at marcusbuck.org
  Zusammenfassung  | Language codes get falsely trimmed two two letters
  Warteschlange    | Horde Framework Packages
  Typ              | Bug
  Status           | Unconfirmed
  Priorität        | 1. Low
  Milestone        |
  Patch            |
  Zuständige       |
------------------------------------------------------------------------------


me at marcusbuck.org (2021-12-17 15:47) hat geschrieben:

In the Native Language Support file Nls.php:280 [1] the language code  
is trimmed to two characters. Probably under the assumption that  
language codes are always ISO 639 and all character after that are  
country subtags. But RFC 3282 [2} and RFC 3066 [3] clearly allow three  
letter language codes from ISO 639-2 and some reserved codes.

This excludes languages as important as Cebuano (ceb) with 30 million  
speakers in the Philippines and even misinterprets Cebuano as Chechen  
(ce).

I came across this error when the accept-language mail header for Low  
German (nds) was misreported as North Ndebele (nd).

The correct fix is to allow all valid language codes. That should be  
doable with CLDR. That will probably require some code refactoring. If  
it is not possible to fix this easily, it would be nice if in the  
meantime at least the languages wouldn't be misreported. If a code is  
"unknown" it should be possible to create a dummy  
Horde_Nls_Translation object and just have the language code as output.

[1] <https://github.com/horde/Nls/blob/master/lib/Horde/Nls.php#L280>
[2] <https://datatracker.ietf.org/doc/html/rfc3282>
[3] <https://datatracker.ietf.org/doc/html/rfc3066>





More information about the bugs mailing list