Перемикання мов

Posted on

Знайшов чудовий плагін для WordPress: Language Switcher.

Лише одна проблема поки що: віджет для NextGEN Gallery не хоче, щоб я йому відредагував заголовок таким чином, щоб він також «перемикався».

Ну, і доводиться редагувати файли теми — міняти "шось" на __("шось"), паралельно підправляючи відповідний .po (і потім msgfmt uk.po -o uk.mo).

2 Replies to “Перемикання мов”

  1. Yes, i’ll try :-)

    1. NGGallery is great. To display its widget title in different languages you simply need to have you specific title translated in WP’s “global” .mo file (is it clear? my english is poor, sorry) — and find in nggwidget.php line like
    echo $before_widget . $before_title . $options[$number][‘title’] . $after_title;
    and replace it with:
    echo $before_widget . $before_title . __($options[$number][‘title’]) . $after_title;

    2. You theme files often may be “untranslated” — they often contain english names for titles etc. To have them translated, you need replace every displayed “word” with (or _e(‘word’) in place of __(‘word’) — depending of ‘word’ is printed on screen or used in variables to be printed later).

    3. Sometimes (as with NextGen Gallery) you need to add some word to you language’s .po file (uk.po, or uk_UA.po for Ukrainian) and then convert this .po to .mo (every software with gettext support looks into .mo files for translated messages)

    Topic 2 covered great at Language Switcher Home.

Залишити відповідь

Ваша e-mail адреса не оприлюднюватиметься. Обов’язкові поля позначені *

Цей сайт використовує Akismet для зменшення спаму. Дізнайтеся, як обробляються ваші дані коментарів.