Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @ericampleman – Hey, thanks for trying SlickQuiz! Right now, the mulit-language support is somewhat lacking in this plugin. It shouldn’t be too difficult to implement, so I’ll try and get a fix out for this within the next week or so. Stay tuned!

    Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @ericampleman – Turns out this is a bit more involved than I thought, so it might be a little while before I can set aside the time to get this change out.

    I’ve setup an issue on github to address this: https://github.com/QuickenLoans/SlickQuiz-WordPress/issues/30

    Stay tuned…

    Thread Starter ericampleman

    (@ericampleman)

    No stress!

    I replaced many text by symbols and I created a quiz in englisn and a second one ine french.

    I work very well!

    Thank you!

    Hi!

    A little help for you. This is not to difficult. Here is my function for this:

    public function loadLanguage() {
    		$moFile = $this->languageDir . WPLANG . '.mo';
    		if (file_exists($moFile)) {
    			$dir = $this->pluginName . '/languages';
    			load_textdomain($this->pluginName, $moFile);
    			load_plugin_textdomain($this->pluginName, false, $dir);
    		} else {
    			trigger_error('The language you did set in the configuration.php is not exists in ' . $this->languageDir, E_USER_ERROR);
    			die();
    		}
    	}

    this is load the en-EN.mo (or hu-HU, etc…) file from the wp-plugins/

    After this, you can use 2 functions for translated texts:

    one is _(“This is a string”, $this->pluginName);
    (If your plugin name is slickQuiz, you can use it:
    _(“This is a string”, “slickQuiz”);

    but is more lucky, if you define a constant, define(“SQ_TEXT_DOMAIN”, “slickQuiz”); and after that, use:
    _(“This is a string”, SQ_TEXT_DOMAIN);

    so, _($str, SQ_TEST_DOMAIN); will echo the translated $str texts from the .mo file.

    the other function is: __($str, SQ_TEST_DOMAIN);
    with 2 underscores. it’s mean, it will return with the translated text, so you can use it as return values.

    So, you should mage a language/ directory under your plugins root directory, make a catalog en-EN.po file here, set the sources path to “..” in poEdit progam (https://www.poedit.net/), refresh the catalog from source, and after this, everybody can translate it.

    if you have any question about this, let me know.

    I misstyped:

    this is load the en-EN.mo (or hu-HU, etc…) file from the wp-plugins/yourpluginname/languages/

    and TEST_DOMAIN is TEXT_DOMAIN of course, sorry, morning here ??

    ok, i missed a lot of thing in my first post. of course, the first function is not _. it’s called _e($str, SQ_TEXT_DOMAIN);

    But nevermind. I did it for you.
    Download the zip file from here:
    https://vaso.sma.hu/slickquiz_localized.zip

    Check the main file of your plugin, the slickquiz.php

    From line 37 – 54.
    Change your WPLANG to hu_HU in your wp-config.php (on local or a dev site), and you will see, the “Get Started!” string will be “Indulj el!”

    Also check the slickquiz-helper.php how i translated that text.

    Plugin Author jewlofthelotus

    (@jewlofthelotus)

    @ferenc Vasóczki – Thanks for all the notes! I am familiar with how to implement internationalization, I just simply haven’t had the time to go through every file and wrap every string in the internationalization methods. Of course, you’re always welcome to submit a pull request on github: https://github.com/QuickenLoans/SlickQuiz-WordPress

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Many languages?’ is closed to new replies.