php turkish locale

Tagged:  

When I've just install gallery2 on to my lap. When logged with another user I got error which I came across before that Php got confused with our locale. I found php bug entry since 2002 it is still open. Before gallery I found some scripts wont work for my locale before. But I had time constrain that I couldnt dig so much.

There exists a comment in the bug entry about solution.

onur dot oguzel at gmail dot com

i guess nobody looks at this bug,
setlocale(LC_ALL, 'tr_TR');
setlocale(LC_CTYPE, 'en_US');

sure solves this but it is still a bug :)

Yes it is obviously a bug and only effects turkish people. Problem is since 2002 there is only 20 comments. It is not so much to force php programmers to fix. Being turk is hard sometimes.

Coming to solution there is a GalleryTranslator.class file in the gallery2/modules/core/classes directory.
open the file and find the

GalleryTranslator::_setlocale(LC_ALL, $languageCode);

section. Add afterwards followind two lines and that reads

GalleryTranslator::_setlocale(LC_ALL, $languageCode);
if($languageCode=='tr_TR')
GalleryTranslator::_setlocale(LC_CTYPE, 'en_US');
.

Now you can easily work in turkish lang.

Similar

  • New technique to win olimpics -

    New technique to win olimpics

    At the 1968 Olympics, Dick Fosbury took the athletics world by surprise with an unusual high-jump technique.

  • Printing mysql_error -

    Printing mysql_error

    This is a code snipped to print mysql error.
    If there is no error mysql_error returns null, thus if evaluates false and there is no output.

  • multiple ON DUPLICATE KEY UPDATE -

    multiple ON DUPLICATE KEY UPDATE

    Here is an example of how to update multiple columns using values supplied in the INSERT statement. This assumes that column 'a' is the unique key.

  • multiple ON DUPLICATE KEY UPDATE -

    multiple ON DUPLICATE KEY UPDATE

    Here is an example of how to update multiple columns using values supplied in the INSERT statement. This assumes that column 'a' is the unique key.

  • php unlink recursive -

    php unlink recursive

    The shortest recursive delete possible.

    <?php
    /**
    * Delete a file or recursively delete a directory
    *
    * @param string $str Path to file or directory
    */