Turkish translation file for 1.9.4 (ZBX-3828)

[ZBX-3855] turkish locale does not work (php bug) Created: 2011 Jun 01  Updated: 2013 Dec 19  Resolved: 2013 Dec 14

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: None
Fix Version/s: 2.0.4rc1, 2.2.2rc1, 2.3.0

Type: Sub-task Priority: Major
Reporter: richlv Assignee: Pavels Jelisejevs (Inactive)
Resolution: Fixed Votes: 0
Labels: localization
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by ZBX-5964 Zabbix turkish locale support for fro... Closed

 Description   

tr_TR locale does not work because of a bug in php

http://bugs.php.net/bug.php?id=35050



 Comments   
Comment by Alexei Vladishev [ 2012 Sep 06 ]

It was fixed by PHP team under https://bugs.php.net/bug.php?id=18556. I am closing it.

Comment by richlv [ 2012 Sep 06 ]

oh, that's great !
let's do two things under this issue :

(1) add turkish locale to the translation dropdown (this can only be done after 2.0.3 is out, as we're in string freeze currently);
(2) document that it will only work starting with php version x

Comment by richlv [ 2012 Sep 07 ]

(3) although an even better solution would be not to allow saving profile if turkish is selected with php version < n - is that something we can do for 2.0.4 ?

Comment by richlv [ 2012 Sep 08 ]

btw, i tested php trunk snapshot as of today, and it still failed for me with turkish locale in zabbix. to be investigated.

Comment by Murat Koç [ 2012 Sep 17 ]

Tested on opensuse 12.2 with custom compiled apache 2.3.4 and php-php-src-6cc9d99 (latest git master) and with pre-zabbix-2.0.3rc1-30188.

Failed with

PHP Fatal error: Class 'CInput' not found in /opt/apache2/htdocs/include/classes/class.cvar.php on line 54

error.

Comment by Murat Koç [ 2012 Sep 17 ]

Tested it with

http://www.topolis.lt/php/turkish.phps

and it passed all the tests with the same settings.

Comment by richlv [ 2012 Dec 20 ]

turkish locale was aded to the language dropdown list for 2.0.5.
would be great if somebody could try it out in 2.0 svn branch and report the results

Comment by Baris Karakaya [ 2012 Dec 22 ]

Hi richards,
I will try it. Newly downloaded 2.0.5 rc1, and after configuration I will report to you.

Comment by Oleksii Zagorskyi [ 2012 Dec 22 ]

Debian/testing

# php --version
PHP 5.4.4-10 (cli) (built: Nov 24 2012 11:21:26) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

Tested 2.0 SVN head rev 32283.

Error:
Fatal error: Class 'CInput' not found in /zab/www-dev/zabbix20/include/classes/class.cvar.php on line 54

Comment by Oleksii Zagorskyi [ 2012 Dec 22 ]

Just downloaded from: http://snaps.php.net/php5.5-201212221430.tar.gz
Size: 15.0 MB (15,655,762 bytes)
or

Compiled, phpinfo() shows:
PHP Version 5.5.0-dev
System Linux it0 3.2.0-3-amd64 #1 SMP Mon Jul 23 02:45:17 UTC 2012 x86_64
Build Date Dec 22 2012 17:23:25
...

The same error:
Fatal error: Class 'CInput' not found in /zab/www-dev/zabbix20/include/classes/class.cvar.php on line 54

The same for:
http://snaps.php.net/php-trunk-201212221630.tar.gz

PHP Version 5.6.0-dev
System Linux it0 3.2.0-3-amd64 #1 SMP Mon Jul 23 02:45:17 UTC 2012 x86_64
Build Date Dec 22 2012 20:09:14

Comment by Murat Koç [ 2013 Feb 21 ]

As a workaround by adding these lines to these files makes the web interface working with Turkish locale.

Maybe you should consider adding these while waiting for a proper fix from php.

jsLoader.php

bindtextdomain('frontend', 'locale');
bind_textdomain_codeset('frontend', 'UTF-8');
textdomain('frontend');
+ if ( $locale == 'tr_TR' )
+

{ + setlocale(LC_CTYPE, array('C', 'POSIX', 'en', 'en_US', 'en_US.UTF-8', 'English_United States.1252', 'en_GB', 'en_GB.UTF-8')); + }
}
else { error('Your PHP has no gettext support. Zabbix translations are not available.'); }


include/config.php


bindtextdomain('frontend', 'locale');
bind_textdomain_codeset('frontend', 'UTF-8');
textdomain('frontend');
+ if ( $locale == 'tr_TR' )
+ { + setlocale(LC_CTYPE, array('C', 'POSIX', 'en', 'en_US', 'en_US.UTF-8', 'English_United States.1252', 'en_GB', 'en_GB.UTF-8')); + }


}
else

{ error('Your PHP has no gettext support. Zabbix translations are not available.'); }
Comment by richlv [ 2013 Mar 16 ]

hmm, but does it work without any modifications with the latest php version ?

Comment by Oleksii Zagorskyi [ 2013 Mar 16 ]

ohh, two months ago I tried very simple PHP code (I've googled it) with tr_TR on different PHP versions.
It is here:

<?php
echo 'Starting...<br />';
$class = 'PharFileInfo';
echo 'Locale: '.setlocale(LC_ALL, '0')."<br />";
echo "$class exists? ".var_export(class_exists($class), true)."<br />";
echo strtolower('THIS IS JUST A TEST')."<br />";
echo 'Locale: '.setlocale(LC_ALL, 'tr_TR.UTF-8')."<br />";
echo "$class exists? ".var_export(class_exists($class), true)."<br />";

setlocale(LC_ALL, 'tr_TR.UTF-8');
echo strtolower('THIS IS JUST A TEST');
?>

What I got as an output in my browser (PHP version and its output respectively):

PHP Version 5.4.4-14 from Debian testing packages
Starting...
Locale: C
PharFileInfo exists? true
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? false
thIs Is just a test

Next all are compiled myself from sources:

PHP Version 5.1.6
Starting...
Locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
PharFileInfo exists? false
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? false
thIs Is just a test

PHP Version 5.2.17
Starting...
Locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
PharFileInfo exists? false
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? false
thIs Is just a test

PHP Version 5.3.13
Starting...
Locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
PharFileInfo exists? false
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? false
thIs Is just a test

PHP Version 5.4.0
Starting...
Locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
PharFileInfo exists? false
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? false
thIs Is just a test

PHP Version 5.4.3
Starting...
Locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
PharFileInfo exists? true
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? false
thIs Is just a test

PHP Version 5.5.0-dev
Starting...
Locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
PharFileInfo exists? false
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? false
thIs Is just a test

PHP Version 5.6.0-dev
Starting...
Locale: LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=C;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C
PharFileInfo exists? true
this is just a test
Locale: tr_TR.UTF-8
PharFileInfo exists? true
thIs Is just a test

Find all "true" words in the output above to see difference between versions.

After such test I found that in the Internet are sites designed to test specific PHP code on different PHP versions, heh

But zabbix frontend doesn't work on any PHP version, including 5.6.0-dev.
Frontend gives error:
Fatal error: Class 'CInput' not found in /zab/www-dev/zabbix20/include/classes/class.cvar.php on line 54

Comment by Fatih Murat [ 2013 Apr 03 ]

Hello
My server versions of php and apache as follows.
User interface come as a blank after the change console language to Turkish (tr_TR).
I didn't resolve this problem.
How can I solve this problem.
Can you help me please?

Thanks.
PHP 5.4.13 (cli) (built: Mar 14 2013 08:57:49)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Server version: Apache/2.2.15 (Unix)
Server built: Feb 22 2013 11:19:58

Comment by Oleksii Zagorskyi [ 2013 Apr 04 ]

murat, you can fix it by this SQL query:

update users set lang="en_GB" where alias="Admin";

just replace Admin with your login name.

Comment by Fatih Murat [ 2013 Apr 04 ]

Thank you so much
I want to use dashboard with turkish language, for that copy to all files in locale/tr/LC_MESSAGES directory to locale/zh_TW/LC_MESSAGES.

Then I changed it to zh_TW language of the user console.
Now use my console in Turkish
Is there another method I do not know.

Comment by Oleksii Zagorskyi [ 2013 Apr 04 ]

Hmm, interesting "hackish" approach

Comment by Murat Koç [ 2013 Apr 30 ]

I have asked a php expert friend and he said that although it is said that Turkish locale problem fixed in latest php trunk, it is not!

He told me about problem and show some examples with strtolower vs mb_strtolower, LC_CTYPE etc

I have added below two lines patch to overcome the problem, without this patch Turkish locale doesn't and will not work.

So please consider to add it.

Turkish.Patch
--- include/config.inc.php.orig 2013-04-29 18:27:51.316787127 +0300
+++ include/config.inc.php      2013-04-30 18:06:53.553996114 +0300
@@ -197,6 +197,8 @@
                bindtextdomain('frontend', 'locale');
                bind_textdomain_codeset('frontend', 'UTF-8');
                textdomain('frontend');
+               if ( $locale == 'tr_TR' )
+               { setlocale(LC_CTYPE, array('C', 'POSIX', 'en', 'en_US', 'en_US.UTF-8', 'English_United States.1252', 'en_GB', 'en_GB.UTF-8')); } 
        }
        else {
                error('Your PHP has no gettext support. Zabbix translations are not available.');
Comment by richlv [ 2013 Apr 30 ]

hmm, but that's a workaround and a specific case for the turkish locale, right ? why do we have to set locale to english here ?

Comment by Murat Koç [ 2013 Apr 30 ]

Yes, it is specific for Turkish locale case and maybe Azerbaijani, not LC_ALL locale, only the LC_CTYPE

http://www.gnu.org/savannah-checkouts/gnu/libc/manual/html_node/Locale-Categories.html

LC_CTYPE
This category applies to classification and conversion of characters, and to multibyte and wide characters; see Character Handling, and Character Set Handling.

With LC_CTYPE=tr_TR php cannot do the proper character translation and we get

Fatal error: Class 'CInput'

because of "I" letter in CInput but that is not the only function which creates problem, I have also seen this line

PHP Fatal error: Class 'CListItem' not found in

as you can see it has also "I" letter.

In Turkish, character translation should be like that

i --> İ
ı --> I

There is an explanation in here (also php bug page), since I am not a php coder I really don't know the exact details but I have been told that the problem still exists and the only way to make the zabbix frontend work with Turkish locale is to set LC_CTYPE something else.

http://onurguzel.net/2009/07/31/php-turkish-locale-problem/

So, in fact php bug not fixed and you can see it yourselves.

Comment by Murat Koç [ 2013 Nov 20 ]

Hi,

Tested again with php-master snapshot which seems 5.7.0-dev with apache 2.4.6 and zabbix-2.2.0, still same problems exists with the below log

[Wed Nov 20 22:04:15.253834 2013] [:error] [pid 19427:tid 139654871373568] [client 192.168.56.1:40274] PHP Fatal error: Class 'CListItem' not found in /opt/apache/htdocs/include/classes/class.clist.php on line 48, referer: http://192.168.56.135/dashboard.php?sid=f1133d6284ca6ecb

Here is the patch for the zabbix-2.2.0, I can use zabbix in Turkish with this two lines patch.

Zabbix-2.2-Turkish.Patch
--- include/classes/core/ZBase.php.orig 2013-11-12 08:07:32.000000000 +0200
+++ include/classes/core/ZBase.php      2013-11-20 22:07:55.029820981 +0200
@@ -349,6 +349,8 @@
                        bindtextdomain('frontend', 'locale');
                        bind_textdomain_codeset('frontend', 'UTF-8');
                        textdomain('frontend');
+                       if ( $locale == 'tr_TR' )
+                       { setlocale(LC_CTYPE, array('C', 'POSIX', 'en', 'en_US', 'en_US.UTF-8', 'English_United States.1252', 'en_GB', 'en_GB.UTF-8')); }
                }
                else {
                        error('Your PHP has no gettext support. Zabbix translations are not available.');
Comment by richlv [ 2013 Nov 21 ]

hmm. what do php developers say about it ?
is there a new bugreport, seeing how the old one has been closed ?

Comment by Murat Koç [ 2013 Nov 21 ]

It seems they say nothing

https://bugs.php.net/bug.php?id=66108

The problem is I couldn't manage to get the wrong output as stated in this bug report, I got "20" with the 5.7.0-dev and all other Turkish character tests passed without problem.

But whatever I have done I couldn't manage to use zabbix with Turkish locale without this two lines patch.

So, I am not sure about if it's the php bug or zabbix problem and every php coder that I talked to about this problem have already gave up and use this little hackish approach

Without this patch I can't see the point to continue to translate.

Comment by richlv [ 2013 Nov 21 ]

i wanted to test this, but all master snapshots are empty :/
what are the results if you try the posted testcase in the comment in that php bugreport ?

Comment by Murat Koç [ 2013 Nov 21 ]

I downloaded from github

https://github.com/php/php-src

I forgot to add setlocale thing, now I tested again and I have got the same output as stated in bug report.

[Thu Nov 21 22:04:49.094569 2013] [:error] [pid 54024:tid 139972396881664] [client 192.168.56.1:41484] PHP Warning: constant(): Couldn't find constant test::PRODUCTiON in /opt/apache/htdocs/turkish.php on line 7

so it is PHP bug not related to zabbix and I can't decide if this is good or bad

Comment by Murat Koç [ 2013 Nov 25 ]

Have you find time to test it?

What will be the next step?

Comment by richlv [ 2013 Nov 25 ]

i voted on https://bugs.php.net/bug.php?id=66108 ...
although looking at the timeline i'm starting to lean towards implementing some hack just to make it work :/

Comment by richlv [ 2013 Dec 06 ]

for the record, we will investigate possibility of such a hack (given that this php bug is almost as old as zabbix - ~ 11 years )

if it turns out to be a reasonable workaround, it might go in some near future 2.2.x release

Comment by Murat Koç [ 2013 Dec 06 ]

That is great news

and I promise if it will go in any 2.2.x release, I'll make at least %90 of the translation completed

Comment by Pavels Jelisejevs (Inactive) [ 2013 Dec 09 ]

RESOLVED in svn://svn.zabbix.com/branches/dev/ZBX-3855.

Comment by Murat Koç [ 2013 Dec 09 ]

Thanks Pavels, clever solution, let the translation begin

Comment by richlv [ 2013 Dec 09 ]

(1) since 2.2, we only enable locales once they are at 100% - turkish currently is at 31%, i guess we should not enable it yet

jelisejev RESOLVED in r40993.

<richlv> commit messag references ZBX-7454 - otherwise CLOSED

Comment by Ivo Kurzemnieks [ 2013 Dec 10 ]

(2)
Login screen

setlocale(): Invalid locale category name LC_MESSAGES, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME

Inner pages

    Use of undefined constant LC_MESSAGES - assumed 'LC_MESSAGES' [dashboard.php:21 → require_once() → ZBase->run() → ZBase->initLocales() in C:\Development\ZBX-3855-test\frontends\php\include\classes\core\ZBase.php:348]
    setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead [dashboard.php:21 → require_once() → ZBase->run() → ZBase->initLocales() → setlocale() in C:\Development\ZBX-3855-test\frontends\php\include\classes\core\ZBase.php:348]
    setlocale(): Invalid locale category name LC_MESSAGES, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME [dashboard.php:21 → require_once() → ZBase->run() → ZBase->initLocales() → setlocale() in C:\Development\ZBX-3855-test\frontends\php\include\classes\core\ZBase.php:348]
    Use of undefined constant LC_MESSAGES - assumed 'LC_MESSAGES' [dashboard.php:21 → require_once() → ZBase->run() → ZBase->initLocales() in C:\Development\ZBX-3855-test\frontends\php\include\classes\core\ZBase.php:348]
    setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead [dashboard.php:21 → require_once() → ZBase->run() → ZBase->initLocales() → setlocale() in C:\Development\ZBX-3855-test\frontends\php\include\classes\core\ZBase.php:348]
    setlocale(): Invalid locale category name LC_MESSAGES, must be one of LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, LC_NUMERIC, or LC_TIME [dashboard.php:21 → require_once() → ZBase->run() → ZBase->initLocales() → setlocale() in C:\Development\ZBX-3855-test\frontends\php\include\classes\core\ZBase.php:348]

When switching to Turkish language

Locale for language "tr_TR" is not found on the web server. Tried to set: Turkish_Turkey.1254, turkish. Unable to translate Zabbix interface.

and in some places

Locale for language "tr_TR" is not found on the web server. Tried to set: tr_TR, tr_TR.utf8, tr_TR.UTF-8, tr_TR.iso885915, tr_TR.ISO8859-1, tr_TR.ISO8859-2, tr_TR.ISO8859-4, tr_TR.ISO8859-5, tr_TR.ISO8859-15, tr_TR.ISO8859-13, tr_TR.CP1131, tr_TR.CP1251, tr_TR.CP1251, tr_TR.CP949, tr_TR.KOI8-U, tr_TR.US-ASCII, tr_TR.eucKR, tr_TR.eucJP, tr_TR.SJIS, tr_TR.GB18030, tr_TR.GB2312, tr_TR.GBK, tr_TR.eucCN, tr_TR.Big5HKSCS, tr_TR.Big5, tr_TR.armscii8, tr_TR.cp1251, tr_TR.eucjp, tr_TR.euckr, tr_TR.euctw, tr_TR.gb18030, tr_TR.gbk, tr_TR.koi8r, tr_TR.tcvn. Unable to translate Zabbix interface.

My environment: Apache/2.4.6 (Win32) OpenSSL/0.9.8y PHP/5.5.1

jelisejev The LC_MESSAGES problem has been RESOLVED in r40992. Regarding the second problem: it seems that the Turkish locale is missing on your system.

Eduards CLOSED

Comment by Eduards Samersovs (Inactive) [ 2013 Dec 18 ]

Tested

Comment by Pavels Jelisejevs (Inactive) [ 2013 Dec 19 ]

Fixed in 2.2.2rc1 r41098 and 2.3.0 r41099.

CLOSED.

Generated at Thu Apr 25 20:28:10 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.