BCP 47 Support In CentOS 7 PHP

Home » CentOS » BCP 47 Support In CentOS 7 PHP
CentOS No Comments

This is something I would like to share, and if possible, get feedback.

I am working on a calendar webapp – something to replace Google Calendar for webmasters that do not like the idea of their users being tracked.

Part of that project involves time zone selection, and time zone selection I want internationalized, and I found the existing functions in PHP to be extremely poor.

As in the php function for getting the preferred language from the browser was often flat out incorrect.

That led me to creating my own class for BCP 47 support :

https://calendar.librelamp.com/BCP47

Not perfect yet (er, probably never will be perfect) but at least the bugs I find are my bugs so I can figure out how to fix them.

Just found one – with perfectly valid language tag es-419 when the class attempts to create a glibc language tag, it uses es_ES.utf8 which is obviously wrong. I didn’t take into account UN region codes when it tries to find a glibc match.

But anyway, I know it is asking a lot, but I want to get this right and would love feedback from anyone who deals with internationalizing php web applications.

Thanks,

Alice