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

Adding custom strings (i18n)

Hi,

how can I add custom strings to a language-pack?

Regards,

chriss
Tagged:

Comments

  • Do you mean change existing strings?
    Or add new ones?

    To change existing ones you would either make a custom language pack yourself or suggest alternative translations at http://i18n.osticket.com.

    If you mean add new ones entirely then you cannot at this time with out changing the source files.
  • OK, thanks, can you hint me, where to add some lines of code to read an additional, lets say "custom_strings.inc"? I guess one could easily define an array of strings => translations and merge this to the actual strings-array?

    Regards,

    chris
  • Nope.  I have never even looked at the code in the language packs and/or how it integrates with the rest of the project.
  • Just a FYI:
    It's planned to make it available to change strings individually in the future with phase 4 of the multi language project. Currently the multi language support is at phase 2 of 4. With individual changes is meant to e.g. change the word "ticket" to "flower". Does not help you right away, but as already said, it's just a FYI ;)
  • OK, thanks!
  • here's my solution:

    in class.translation.php add this to function load_tables() :
    if(file_exists(I18N_DIR .'custom_' .$_SESSION['__sn']['lang'] .'.inc')){
          $this->cache_translations += (include I18N_DIR .'custom_' .[lang] .'.inc');
    }
    put a custom_[lang].inc file like this into your i18n-directory.

    if [lang] would be "de":
    <?php
    $custom_de = array();
    $custom_de['Show mine only'] = 'Nur meine anzeigen';
    $custom_de['Est.'] = 'Gesch.';
    ...
    $custom_de['Edited on %s by %s'] = 'Bearbeitet am %s von %s';
    $custom_de['<b>%s</b> posted %s'] = '<b>%s</b> erstellt am %s';

    return $custom_de;
    ?>
Sign In or Register to comment.