WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Attributron 2000] Translations?

[Plugin: Attributron 2000] Translations?

Viewing 1 replies (of 1 total)
  • Hi,

    You can add translations with some skills, the plug-in is translation ready, so the translations will probably appear in a future versions.

    I resolved the case by creating translation file (for Polish):

    wp-content/languages/dws_attributron-2000-pl_PL.po

    Then I looked into plug-in source:

    wp-content/plugins/attributron-2000/a2k.php

    and searched for any instructions beggining with _( or __(

    They contain translation keys. Then I put these keys into:

    wp-content/languages/dws_attributron-2000-pl_PL.po

    Partial example:

    msgid ""
    msgstr ""
    "PO-Revision-Date: 2012-07-24 12:41:58+0000\n"
    "MIME-Version: 1.0\n"
    "Content-Type: text/plain; charset=UTF-8\n"
    "Content-Transfer-Encoding: 8bit\n"
    "Project-Id-Version: 3.4.x\n"
    
    #:
    msgid "Sources:"
    msgstr "Wykorzystane materiaƂy:"

    So for the found word Sources: (from code) I created its translated version, and so on.

    Next step is to convert PO file to MO file that WordPress understands. If you have shell access and the system is kind of Unix, then you can use msgfmt. In my case:

    cd wp-content/languages
    msgfmt -o dws_attributron-2000-pl_PL.mo dws_attributron-2000-pl_PL.po

    If you don’t have shell access, then see the thread on StackOverflow.

    The last step is telling your theme to load translation files just created. Edit your functions.php and add initializer. In my case it was:

    function attributron_trans_init() {
      load_textdomain('dws_attributron-2000', WP_CONTENT_DIR . "/languages/dws_attributron-2000-pl_PL.mo");
    }
    
    add_action('init', 'attributron_trans_init');
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Attributron 2000] Translations?’ is closed to new replies.