WordPress.org

Ready to get started?Download WordPress

Forums

SlickQuiz
Many languages? (9 posts)

  1. ericampleman
    Member
    Posted 10 months ago #

    Hi,

    we have a bilingual site: French and English.

    Is it possible to have the same quiz in both language?
    I know I can create a FR quiz an other in EN but the text button is display only on one language.

    I try with this code on option page but doesn't work :
    [:en]Start[:fr]Commencer

    Thank you!

    http://wordpress.org/plugins/slickquiz/

  2. jewlofthelotus
    Member
    Plugin Author

    Posted 10 months ago #

    @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!

  3. jewlofthelotus
    Member
    Plugin Author

    Posted 9 months ago #

    @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...

  4. ericampleman
    Member
    Posted 9 months ago #

    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!

  5. Ferenc Vasóczki
    Member
    Posted 9 months ago #

    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 (http://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.

  6. Ferenc Vasóczki
    Member
    Posted 9 months ago #

    I misstyped:

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

  7. Ferenc Vasóczki
    Member
    Posted 9 months ago #

    and TEST_DOMAIN is TEXT_DOMAIN of course, sorry, morning here :)

  8. Ferenc Vasóczki
    Member
    Posted 9 months ago #

    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:
    http://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.

  9. jewlofthelotus
    Member
    Plugin Author

    Posted 9 months ago #

    @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

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.