• Hi there,

    I almost finished my first plugin that enables an Admin with no knowledge of .php and MySQL to create forms that will be processed and create a .pdf file (according to the format supplied by the Admin).

    At this point I want to do some internationalization (i18n), I got the language of the user saved in $_GET[‘lang’]. At this point I got .mo files for English and Dutch. Now I want to load the .mo file that corresponds to the language in $_GET[‘lang’]. When I read the codex I see that load_plugin_textdomain only loads the directory with language files but doesn’t enable me to switch from user language.

    Any thoughts on how I could do this (I’ve been looking around a lot now, but can’t find anything useful.)

    Kind regards,

    Niels

Viewing 2 replies - 1 through 2 (of 2 total)
  • By example, in xili-language or other multilingual plugins, the change of visitor side text is done by the plugin and not yours…

    Thread Starter Niellles

    (@niellles)

    Thank you for your answer but I’m not exactly sure how that answers my question…

    I’ve done all printing of text as suggested by the codex:
    To fetch a string simply use __(‘String name’,’your-unique-name’); to return the translation or _e(‘String name’,’your-unique-name’); to echo the translation. Translations will then go into your plugin’s /languages folder.

    Then it talks about loading the language files (loading the whole directory):
    load_plugin_textdomain().

    What I want to do is something like this:

    switch($_GET['lang']) {
        case 'en': ...load this particular file... ; break;
        case 'nl': ...load that particular file...; break;
        default: ...load this particular file...; break;
    }

    I read the codex on load_textdomain() and I think that’s exactly what I’ll need instead of load_plugin_textdomain(). Or am I mistaking?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Making plugin (used-side) multilingual’ is closed to new replies.