Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

GNU gettext : Much Better method for localization

edited September 2006 in Vanilla 1.0 Help
I don't know if this is possible or not .. I haven't seen any discussions about this here ... If Mark could change the way Vanilla uses language files and start using GNU gettext it would be very very easy to localize Vanilla , no matter how the versions changes ... also it will be easier for anyone translating to catch typos and mark un-decided translations as Fuzzy .. so that other translators be able to fix it ... as you may have noticed translation of PO files is very easy using either poEdit for windows http://www.poedit.org/ or Kbabel for linux http://kbabel.kde.org/ ... or if you prefer ... you can use any Unicode capable text editor ... see the popular Filezilla page as an example for the greatness of gettext http://filezilla-project.org/translations.php

Comments

  • Ther is the discussion about it on VanillaDev: http://lussumo.com/vanilladev/discussion/142/language-gettext-rfc/#Item_0
  • That was one of my first question when I joined up.
    I don't think Mark is willing to switch.
    I did, as a test, a simple gettext switch, converting languages definitions to gettext format and hacking the GetDefinition method to a gettext() wrapper.
    Anyway, I'm still unsure if I'll use it or stay standard. Using it offer a better integration with other site code, but require maintenance.
    ?
  • edited September 2006
    I don't know if the Unicode support in PHP 6 http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html will have effect on this or not ... I'm still at the side of PO and MO and POT files ... they are just peace of mind .... Mark Said "I can guarantee that most shared servers will not support it natively." So what? you can(I'm sure) make the primary langauge files use gettext compiled mo files ... at the same time keep the old(current) language file format as an extension for those who don't have gettext with their hosting package .... anyway thats just my opinion .... @Max_B : Can you upload the modified files ? or how to convert vanilla to use gettext as you did? EDIT: also the currently available extensions that enables the change of language at the user level involves modifying vanilla's files and that as I understand from Mark's words means difficult upgrading when an upgrade is available ...
  • Max_BMax_B New
    edited September 2006
    If you look at this post, you'll see that there IS a workaround to use my extension without modifying the core files.

    I uploaded the .mo an .po file for English and French, in this zip file.
    I converted it with a few find/replace pattern or sed command, don't remenber, but it's easy.
    To use it you should modify the file library/Framework/Framework.Class.Context.php as follow:
    function GetDefinition($Code) { //test Max_B return gettext($Code); /* if (array_key_exists($Code, $this->Dictionary)) { return $this->Dictionary[$Code]; } else { return $Code; } */ }
    I'd be more efficient to replace all occurences or GetDefinition() with gettext() but then you are REALLY out of sync at next upgrade!
  • The file you have attached is corrupted ... when I replace the GetDefinition function I get wierd things like "PanelFooter" under "StartANewDiscussion" which is not appearing right ... and I get under "All Discussions" "PageDetailsMessageFull" .... and the name variable isn't working giving me "SignedInAsX" instead of the usual ...
  • I re-uploaded the zip file…
    …but from your last comment I'm not sure if you should go this way:
    - text you see on screen just mean there is NO dictionary available…
    - Modifying the GetDefinition() code is not the only step to activate gettext. Besid having the right translation file in the right place you'd also add a few lines of code somewhere, say in conf/language.php or in a custom extension or whatever.
    Here are the minimum requested lines://init gettext putenv("LANG=$lang"); setlocale(LC_MESSAGES, $lang); bindtextdomain('messages', 'i18n'); textdomain('messages');
    Where $lang contain the language code you want and "i18n" is the directory where you put the translation files.
    This is NOT a ready made exension, this is a little help to find your way, but then you are on your own.
  • I'm sorry if I sounded demanding in my last comment or sounded like its my own right or something... I will try that .. and thanks for all the help
  • No problem, this was just a precaution, I don't want to drive you by an insecure way, with this gettext stuff.
This discussion has been closed.