support for Turkish

This commit is contained in:
Roland Gruber 2013-11-29 19:47:29 +00:00
parent bd9f619c6e
commit 4fcb0c270e
8 changed files with 46 additions and 12 deletions

View File

@ -6,6 +6,7 @@ December 2013 4.4
- Unix: switch also additional membership if primary group is changed (RFE 108)
- Windows: fixed user name handling, sAMAccountName now optional
- Apache 2.4 support (requires Apache "version" module)
- Turkish translation
- LAM Pro:
-> Bind DLZ support
-> Samba/Shadow: display password change date in self service

View File

@ -44,6 +44,9 @@ ru_RU.utf8:UTF-8:Русский (Россия)
# Slovakian
sk_SK.utf8:UTF-8:Slovenčina (Slovensko)
# Turkish
tr_TR.utf8:UTF-8:Türkçe (Türkiye)
# Japanese
ja_JP.utf8:UTF-8:日本語 (日本)

View File

@ -446,11 +446,14 @@ class samba3domain {
* @return boolean true if matches, otherwise false
*/
function get_preg($argument, $regexp) {
/* Bug in php preg_match doesn't work correct with utf8
*/
/* Bug in php preg_match doesn't work correct with utf8 */
$language = explode(":", $_SESSION['language']);
$language2 = explode ('.', $language[0]);
setlocale(LC_ALL, $language2[0]);
// workaround for buggy PHP with Turkish
if (($language[0] == 'tr_TR.utf8') && (version_compare(phpversion(), '5.5') < 0)) {
setlocale(LC_CTYPE, 'en_GB');
}
// First we check "positive" cases
$pregexpr = '';
switch ($regexp) {
@ -577,9 +580,12 @@ function get_preg($argument, $regexp) {
}
if ($pregexpr!='')
if (preg_match($pregexpr, $argument)) {
/* Bug in php preg_match doesn't work correct with utf8
*/
/* Bug in php preg_match doesn't work correct with utf8 */
setlocale(LC_ALL, $language[0]);
// workaround for buggy PHP with Turkish
if (($language[0] == 'tr_TR.utf8') && (version_compare(phpversion(), '5.5') < 0)) {
setlocale(LC_CTYPE, 'en_GB');
}
return true;
}
// Now we check "negative" cases, characters which are not allowed
@ -597,14 +603,20 @@ function get_preg($argument, $regexp) {
}
if ($pregexpr!='')
if (!preg_match($pregexpr, $argument)) {
/* Bug in php preg_match doesn't work correct with utf8
*/
/* Bug in php preg_match doesn't work correct with utf8 */
setlocale(LC_ALL, $language[0]);
// workaround for buggy PHP with Turkish
if (($language[0] == 'tr_TR.utf8') && (version_compare(phpversion(), '5.5') < 0)) {
setlocale(LC_CTYPE, 'en_GB');
}
return true;
}
/* Bug in php preg_match doesn't work correct with utf8
*/
/* Bug in php preg_match doesn't work correct with utf8 */
setlocale(LC_ALL, $language[0]);
// workaround for buggy PHP with Turkish
if (($language[0] == 'tr_TR.utf8') && (version_compare(phpversion(), '5.5') < 0)) {
setlocale(LC_CTYPE, 'en_GB');
}
return false;
}

View File

@ -58,9 +58,13 @@ function setlanguage() {
if (!isset($_SESSION['language'])) {
$_SESSION['language'] = "en_GB.utf8:UTF-8:English (Great Britain)";
}
$language = explode(":", $_SESSION['language']);
$language = explode(":", trim($_SESSION['language']));
putenv("LANG=" . $language[0]); // e.g. LANG=de_DE
setlocale(LC_ALL, $language[0]); // set LC_ALL to de_DE
setlocale(LC_ALL, $language[0]); // set LC_ALL
// workaround for buggy PHP with Turkish
if (($language[0] == 'tr_TR.utf8') && (version_compare(phpversion(), '5.5') < 0)) {
setlocale(LC_CTYPE, 'en_GB');
}
$locdir = substr(__FILE__, 0, strlen(__FILE__) - 15) . "/locale"; // set path to translations
bindtextdomain("messages", $locdir);
bind_textdomain_codeset("messages", $language[1]);

View File

@ -81,4 +81,8 @@ echo "Generating Slovakian translation template"
./make_po_sk
tar -czf messages.po_sk.tar.gz messages.po
echo "Generating Turkish translation template"
./make_po_tr
tar -czf messages.po_tr.tar.gz messages.po
rm messages.po

View File

@ -4,7 +4,7 @@
# Copyright (C) 2003 - 2006 Roland Gruber
# This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
# This script is run after make_po to merge the existing German translations to messages.po
# This script is run after make_po to merge the existing French translations to messages.po
./make_po
msgmerge -v ../locale/fr_FR/LC_MESSAGES/messages.po messages.po -o messages.po

View File

@ -4,7 +4,7 @@
# Copyright (C) 2003 - 2006 Roland Gruber
# This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
# This script is run after make_po to merge the existing German translations to messages.po
# This script is run after make_po to merge the existing Italian translations to messages.po
./make_po
msgmerge -v ../locale/it_IT/LC_MESSAGES/messages.po messages.po -o messages.po

10
lam/po/make_po_tr Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
# $Id: make_po_it 3354 2009-11-09 18:49:17Z gruberroland $
#
# Copyright (C) 2013 Roland Gruber
# This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
# This script is run after make_po to merge the existing Turkish translations to messages.po
./make_po
msgmerge -v ../locale/tr_TR/LC_MESSAGES/messages.po messages.po -o messages.po