Howdy, Stranger!

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

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

Add new language, translate, activate

Hi, I am trying add czech language into OSTicket. I did upgrade from 1.7 to 1.9.4 stable. I went to http://i18n.osticket.com/project/osticket-official/cs and do some more translations in messages.po. Then I download czech package and copied it in webserver root/include/i18n/cs/.
Now when I switch in preferences into czech I see some few translations (only some help bubles). But I did translate most of text in agent area and as i see the login screen and public site of ticket is translated at http://jipt.i18n.osticket.com.
Do I missing something? Is there any cache for language?

Thank you

Tomas
Tagged:

Comments

  • edited November 2014
    Or should I deleted some gettext files? Some of them from v1.7 are not in new version. Like

    gettext.inc
    gettext-conf.php
    gettext.php

    I tryed change en to cs or delete then but no change ...

    I tryed install other language, but still just help bubles are translated. All other is in english.
    Is messages.po handle different way then other .yaml??
    Something stuck from 1.7 version?
  • You should download the language pack from www.osticket.com/download and use the .phar file instead of the source files from i18n.osticket.com

    Maybe that helps ;)
  • edited November 2014
    thank you, but how can i get .phar file. There is non for CZECH at download page ...

    aaaa you are right. I tryed it with german and its working :] Now is the question: how to create .phar file from translation I did at i18n.osticket.com for czech language? any easy way?

    If I copy translation files to webserver root/include/i18n/cs/ it will do nothing? At least it translate some help bubles :]

    Thank you
  • edited November 2014
    So I got it. it is not that easy:
    1. Create folder - for ex CS, get whole language package and unzip it into folder, you will get something like:
      help
      LC_MESSAGES
      templates

      and some .yaml files

    2. download messages.po - if changed (click on setting button at http://i18n.osticket.com/project/osticket-official/cs and dlownload messages.po
    3. convert message.po into PHP array file - (carefull some PO to PHP array online convertors convert original message and then it doest match original:

      example:
      wrong
      'Invalid-url' => 'Chybná URL',
      should be
      'Invalid URL' => 'Chybná URL',
      I didnt find so i created symple php script - attached

    4. converted file rename to messages.mo.php and put it in folder LC_MESSAGES in your language folder CS
    5. create MANIFEST.php in root of CS folder and edit it (change language code and so) example accached
    6. create php archive . PHAR from all this files. I used phar-util at https://github.com/koto/phar-util unzp util and use (Win) phar-build.bat with commandline

      phar-build.bat -s ./CS -n

      -n as self signed phar archive, CS is folder with your fresh language files
      It will create .phar file

    7. rename .phar file base on your language code - cs.phar
    8. uploade cs.phar into /include/i18n/ on your web server

    Thats it .. not that easy, it would be cool if http://i18n.osticket.com can save language as .phar file :]

    PHP script to "convert PO to PHP array"

    <?php
    $file = 'C:\\CS\\messages.po';
    $translations = array();
    $po = file($file);
    $current = null;
    foreach ($po as $line) {
        if (substr($line,0,5) == 'msgid') {
            $current = trim(substr(trim(substr($line,5)),1,-1));
        }
        if (substr($line,0,6) == 'msgstr') {
            $translations[$current] = trim(substr(trim(substr($line,6)),1,-1));
        }
    }


    $final_file = "<?php\n\n".'return array (';
    foreach ($translations as $msgid => $msgstr) {
        $msgid = str_replace ("'","\'",$msgid);
        $msgstr = str_replace ("'","\'",$msgstr);
       
        $final_file .= "'". $msgid . "' => '" .$msgstr . "',\n";
    }
    $final_file .= ")\n?".">";

    function save_txt_file ($data, $filename) {

      $file = fopen($filename, 'w');
      fwrite($file, $data);  
      fclose($file);
    }
    save_txt_file($final_file,"messages.mo.php");
    ?>


    MANIFEST.php

    <?php return array (
      'Build-Date' => 'Mon, 16 Nov 14 16:48:19 -0100',
      'Build-Version' => 'v1.9.4',
      'Language' => 'cs_CS',
      'Id' => 'lang:cs',
      'Last-Revision' => '2014-11-16 12:15-0100',
      'Version' => 141455,
    );

  • edited November 2014
    Btw czech phar file attached, if someone interested. Just rename it from cs.phar.txt to cs.phar and uload it to /include/i18n/ on your server.
    cs.phar.txt
    259K
  • While I'm glad that you appear to have fixed your issue, people should probably wait for the official version from the web site.
  • Yes I understand. Please just delete post with .phar if needed. I just needed czech translation and it looks like it will not be released soon as its on 25% done. So I just add main parts translation and make own .phar. Maybe if you can create official phar from all languages regulary, like every month, even if the language is not completely translated yet .. 0:-)
  • You could join the project and suggest the translations that you put into your version.  :)
  • I did all translation on http://i18n.osticket.com and then downloaded it and create .phar I mean you - osticket.com should make some section in download like "unfinished/unclomplete translations" and let people download .phar archive for languege even not completed translations yet :)
  • While I'm glad that you appear to have fixed your issue, people should probably wait for the official version from the web site.

  • Hey, I just wanted to pop in here and add a couple details. Thanks again for all the translation assistance.

    The software can be translated in place, without downloading and monkey-patching the translation files. Just visit http://jipt.i18n.osticket.com/. Log into the Crowdin dialog with your Crowdin credentials and into osTicket with username and password "demo" and "demouser" respectively, (without the quotes). This would be the recommended approach since it allows for collaboration, and uses your time effectively.

    Please send @greezybacon messages via Crowdin for other translation related issues, including requests to publish language packs or add new target languages.

    To convert the messages.po to message.po.php, run the include/class.translation.php directly (this is documented at https://github.com/osTicket/osTicket-1.8/blob/develop/setup/doc/i18n.md (setup/doc/i18n.md in the software codebase):

    php include/class.translation.php message.mo > message.mo.php

    Sorry, as of yet, we still don't have a utility to unpack the PHAR files.

    Cheers,
    Jared
  • Possibility to change the translation within the admin would be great.
  • Hi!

    I've downloaded es_ES to use the spanish version but it isn't working, I've also read some other posts and I understand german (de_DE) is working, but somehow Translations aren't working, I don't know if it is the hosting, the php.ini or some other configuration. that I'm Missing...

    Steps I've followed:
    1.- Download phar file (es_ES) 
    2.- upload to my server (Using filezilla) 
    3.- Place phar file into [/public_html/sop-ost/include/i18n/es_ES]  folder
    4.- Verified that the spain (and/or german) flag is active, clicked but not working on user or admin pages.
    4a.- Verified in the profile (scp/profile.php) page the language I'm trying to use is selected / active
    4b.- I've even renamed the (us directory) 

    Any Ideas or suggestions?

    Note: I'm ultimately trying to use es_MX file but it hasn't been approved yet, (and yes, I've contributed to translation and suggestions in the crowdin translation site) but as test, I can live with the spain version now. 
  • @IdeaW you haven't stated the version of osTicket that you are running.  Also this thread is from Nov 2014... you should probably start your own thread.
This discussion has been closed.