• Resolved LostInNetwork

    (@lostinnetwork)


    Hi

    Plugin translation issue, gettext, character sets

    I need to translate a plugin, that has a lot of .po and .mo files in a directory called gettext. There also a .pot file. I have now translated everything (written a translation in msgstr for each msgid). Next I would need to create those .mo files. How do I do this?

    When I run xgettext ec3-fi_FI.po, I get error messages: “invalid multibyte sequence” for each and every “national character”.

    What now? What is that .pot file? Do I need it for something? How do I make these national characters “not invalid”?

    I don’t know what character sets my web hotel (Debian) or my OS (Windows Vista/Ubuntu) uses. The characters show correctly in vi, gedit, notepad.

    This has something to do with ISO-8859-1 and UTF-8

Viewing 5 replies - 1 through 5 (of 5 total)
  • Always use utf-8, since that is the default encoding in WordPress and is godd for any language.

    Regarding the pot file, the po and mo files + translation tools, se the Codex:
    https://codex.www.ads-software.com/Translating_WordPress
    (the technology is the same whether it’s the whole WP or a theme or a plugin)

    Some more info from one of the devs: https://boren.nu/archives/2004/11/01/localizing-plugins-and-themes/

    Thread Starter LostInNetwork

    (@lostinnetwork)

    Problem solved.

    PROBLEM

    I tried to edit the po-files with visual editor (vi) in a SSH session. Bad choice.

    The remote system with the po-files and the vi editor was running Debian (probably UTF-8, but how could I know…)(no xgettext there, and no root/install access).

    The local system had Windows Vista, and Putty was set to interpret characters as ISO-8859-1, if I remember it correctly. I at all looked good. Looked… There was some character set matching problem that my fine editors and terminals did not show…

    This resulted in text files with “invalid multibyte sequence” (all the national, non-ascii, characters). I downloaded these po-files to Windows (poEdit could not convert them to Unicode) and to Ubuntu (invalid multibyte sequence).

    SOLUTION

    I gave up using vi, and loaded the pot to Windows and ran poEdit. Success.

    Thread Starter LostInNetwork

    (@lostinnetwork)

    It is highly annoying though, that I do not know what the problem actually was.

    I fear that some day I notice that – oops – I have ten megabytes of text in the wrong character set…

    Thread Starter LostInNetwork

    (@lostinnetwork)

    (edited)

    Oh no. The plugin is gone.

    I uploaded my ec3-fi_FI.mo to that ec3 plugins gettext directory. I then created a wordpress/languages directory and copied the mo there (needed?) and changed the wp-settings.php (WPLANG to fi_FI).

    The plugins backend is now properly translated, but the widget is gone from the sidebar…

    Thread Starter LostInNetwork

    (@lostinnetwork)

    Ok, so I translated the names of the event calendar widgets… I had to go to Presentation –> Sidebar Widgets and drag the calendar and event list back to the sidebar.

    Works nicely.

    Now I can see how studip the translation looks… need to fine tune…

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Translating plugins. Gettext. Po-files.’ is closed to new replies.