|
@@ -1,3 +1,23 @@
|
|
|
|
|
+# jogai - Python Game Library
|
|
|
|
|
+#
|
|
|
|
|
+# This library is free software; you can redistribute it and/or
|
|
|
|
|
+# modify it under the terms of the GNU Library General Public
|
|
|
|
|
+# License as published by the Free Software Foundation; either
|
|
|
|
|
+# version 2 of the License, or (at your option) any later version.
|
|
|
|
|
+#
|
|
|
|
|
+# This library is distributed in the hope that it will be useful,
|
|
|
|
|
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
+# Library General Public License for more details.
|
|
|
|
|
+#
|
|
|
|
|
+# You should have received a copy of the GNU Library General Public
|
|
|
|
|
+# License along with this library; if not, write to the Free
|
|
|
|
|
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
+#
|
|
|
|
|
+# Ramón Palleiro Rodríguez
|
|
|
|
|
+# Zero! Factorial Studio
|
|
|
|
|
+# info@zero.gal
|
|
|
|
|
+
|
|
|
import gettext as gettext_module
|
|
import gettext as gettext_module
|
|
|
import os
|
|
import os
|
|
|
import sys
|
|
import sys
|
|
@@ -20,10 +40,6 @@ def to_locale(language):
|
|
|
lang, _, country = language.lower().partition('-')
|
|
lang, _, country = language.lower().partition('-')
|
|
|
if not country:
|
|
if not country:
|
|
|
return language[:3].lower() + language[3:]
|
|
return language[:3].lower() + language[3:]
|
|
|
- # A language with > 2 characters after the dash only has its first
|
|
|
|
|
- # character after the dash capitalized; e.g. sr-latn becomes sr_Latn.
|
|
|
|
|
- # A language with 2 characters after the dash has both characters
|
|
|
|
|
- # capitalized; e.g. en-us becomes en_US.
|
|
|
|
|
country, _, tail = country.partition('-')
|
|
country, _, tail = country.partition('-')
|
|
|
country = country.title() if len(country) > 2 else country.upper()
|
|
country = country.title() if len(country) > 2 else country.upper()
|
|
|
if tail:
|
|
if tail:
|