Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product
Vanilla 2.6 is here! It includes security fixes and requires PHP 7.0. We have therefore ALSO released Vanilla 2.5.2 with security patches if you are still on PHP 5.6 to give you additional time to upgrade.

Q&A Plugin Localization: Only some items work

This discussion is related to the Q&A addon.

Hi! A am using the Q&A-Plugin and have translated all strings I could find in the central locale.php - some of these work, some are not translated even though the string is taken exactly from the plugin's source-files and there are no variables inside them either. e.g. the [answered] - badges in the overview stay english, also the [accepted answer] or [rejected answer] badges right with the post / comment stay english. For the latter I could not find a complete string at all in the plugins files, so I suppose they are composed from single words. Those are all included in my translations, but still show up in english. (Also: there is some strange whitespace in those buttons like this: [accepted answer ] with the brackets symbolizing the buttons borders...) Any clues as to what I may have overlooked?

Comments

  • Any luck with this? Did you manage to put together a working locale.php file, and if so, did you submit it to the plugin for incorporating in the next release?

    Perhaps this plugin needs some fixes before all the translations will work? I am about to take a look at translating this plugin and it makes sense not to duplicate effort.

  • Hi Jason, I did not pursue this issue any further, but so far I havve not managed to get the missing translations working. I did translate all strings to German, so I could provide a locale.php with the translations, but as said, not all or better said most strings do not get to be translated in the UI. I suppose the plugin needs fixing that's why I posted here, but that's something that exceeds my expertise with PHP/Vanilla

  • phreakphreak VanillaAPP - Your white label app for Vanillaforums MVP

    Yeah, i have to admit its a horror to translate this and the other plugins.

    @vroom: I'm also trying to germanize QnA, would you mind posting your strings here?

  • phreakphreak VanillaAPP - Your white label app for Vanillaforums MVP

    @voom: Whoa great, i'll check this. But aren't most of the expressions hardcoded in QnA, i had to hack some files manually. :/

  • businessdadbusinessdad Stealth contributor MVP

    @phreak said:
    voom: Whoa great, i'll check this. But aren't most of the expressions hardcoded in QnA, i had to hack some files manually. :/

    That's right. I'm working quite a bit with the QnA plugin (latest version compatible with Vanilla 2.0, taken from Github), there are many strings that are not processed via the T () function and, therefore, not translated. I had to go through all the files (which I had to do anyway to add some custom functionalities) and replace every constant string with a T().

  • kopnakopna Coimbra Portugal ☯
    edited October 2015

    Hail!

    something I did not understand: some words translated, and some not? For example - file class.qna.pluhyn.php present "Unanswered" and "Unanswered Questions." The first is easy converted $ Definition ['unanswered'] = 'No answers'; the second $ Definition ['Unanswered Questions'] = 'Your translation'; - No? Explain please how to achieve display the translation of this sentence. Thank you.

  • peregrineperegrine MVP
    edited October 2015

    @kopna said: For example - file class.qna.pluhyn.php present "Unanswered" and "Unanswered Chuestions."
    the second $ Definition ['Unanswered Questions'] = 'Your translation'; - No? >Explain please how to achieve display the translation of this sentence. Thank you.

    if it presents
    "Unanswered Chuestions."

    you have modified the class.qna.plugin.php or you have translated it already.

    obtain an unmodifed version of plugin.

    you can add this to your conf/locale.php

    $Definition['Unanswered Questions'] = "My Unanswered Questions does translate as title of page";

    http://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale

    if you still have a problem post a screenshot (on this forum) of where it doesn't translate and circle it.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • kopnakopna Coimbra Portugal ☯
    edited October 2015

    No, I'm trying to translate using $ Definition. "unmodifed" - do not understand? I use of original plugin. This is taken from Transifex file: $Definition['Unanswered Questions'] = 'Unanswered Questions';
    He tried to act on instructions from this link [vanillawiki.homebrewforums.net/index.php/Internationalization_%26_Localization]
    (http://vanillawiki.homebrewforums.net/index.php/Internationalization_&_Localization "vanillawiki.homebrewforums.net/index.php/Internationalization_%26_Localization")

    My Unanswered Questions does translate as title of page hat is, how?

  • peregrineperegrine MVP
    edited October 2015

    it is strange indeed. either version difference or another locale file overrides your transifex, that is why I suggested conf/locale.php (since it takes precedence) and provided the tutorial. Titles should be translated now.

    with my version of vanilla and my version of the plugin, the definition works.

    I don't know what version of vanilla you are using or what version of QnA plugin.

    try it if you want, or ignore it, just giving you a suggestion, you decide...

    you can add this to your conf/locale.php

    $Definition['Unanswered Questions'] = "Blah Blah Unanswered Questions Ne does translate Blah";

    http://vanillaforums.org/discussion/26597/tutorial-how-to-change-wording-how-to-change-text-how-to-change-language-how-to-change-locale

    from the plugin itself shows string and it translateable.

    Gdn::Controller()->Title(T('Unanswered Questions'));

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

    kopna
  • kopnakopna Coimbra Portugal ☯
    edited October 2015

    peregrine
    Gdn::Controller()->Title(T('Unanswered Questions')); - it is right! The sentence is translated correctly

    and that is not :( Gdn::Controller()->Title('Unanswered Questions');

    Here is information about this plugin:

    // Define the plugin:
    $PluginInfo['QnA'] = array(
    'Name' => 'Q&A',
    'Description' => "Users may designate a discussion as a Question and then officially accept one or more of the comments as the answer.",
    'Version' => '1.2.2',
    'RequiredApplications' => array('Vanilla' => '2.0.18'),
    'MobileFriendly' => TRUE,
    'Author' => 'Todd Burry',
    'AuthorEmail' => 'todd@vanillaforums.com',
    'AuthorUrl' => 'http://www.vanillaforums.org/profile/todd'

    );

    so this plugin:

    if ($Unanswered) {
    $Args['Wheres']['Type'] = 'Question';
    $Sender->SQL->WhereIn('d.QnA', array('Unanswered', 'Rejected'));
    Gdn::Controller()->Title('Unanswered Questions');
    } elseif ($QnA = Gdn::Request()->Get('qna')) {
    $Args['Wheres']['QnA'] = $QnA;
    }
    }

    downloaded here vanillaforums.org/addon/734/q-a

    Thanks for the help! Later, I will pay attention to such things. =)

Sign In or Register to comment.