Howdy, Stranger!

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

Sign In with Google Sign In with OpenID

How translate elefant cms freamwork?

edited February 2012 in I18n


I tested 1.1.1, it work well.

So, I want to translate in Japanese. How do I?

If this cms freamwork is good, haven't translated in Japanese, Japanese users never use this. Most of us don't want to read English.

I know you set up something to version 1.4 around here. I must wait it for 1.4 will be released?

If possible, please make 'translation page' on hp. I did translate like 'CDATA' or 'array()' type language resource file. But it is not good. Many cms inculded translation system in itself. I hope elefant have it.


  • edited January 2012

    There is a "lang" folder in elefantcms.

    The languages.php defines languages available and which is default. You can modify it like this:


    name = English

    code = en

    charset = UTF-8

    fallback = Off

    default = Off


    name = 日本語

    code = jp

    charset = UTF-8

    fallback = Off

    default = On

    The new_lang.php file is the template for translation. You should rename it "jp", then modify the content.

    After that, you should tell us your work. These sites may be useful:

    Visit certain site, paste code in it, save it, then tell us the url.

    I hope my answer can help you. Good luck!

  • Hi

    I translated some items, but no Japanese display.

    I chased code a bit and use debugger(on netbeans), language_hash is empty. (I missed somewhere??)



  • All files are coded in UTF-8 without BOM? If not, change it.

  • Hi

    sorry, i found my mistake. Japanese resource file name became ja..php.

    It work well now. So I'll continue translate.

  • OK, now report something:

    1.Please think about installer. Hard corded in html.

    2.On pulldown menu, only last item became Japanese.

    3.At the page 'settings' of install, clicked 'save setting' and went next page, but I had noticed I missed, so back to setting page. Correct input and click 'save setting'. Error happened and I was not able to back/foward anymore. (Maybe by click 'sava setting' button, data save into db table at first time, and did again it, failed to validation because data existed already.)

  • Oh, error message is there :SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '1' for key 'PRIMARY'

  • Find more:

    luck of items : 'Website', 'Tools' are not on new_lang.php

  • On desinger page, 'Default' is not translated ( the term on ja.php)

  • On Extra options, Display title : can't translate 'Yes' and 'No'

  • edited January 2012

    If words are written like: {"...some words"} in template, or use i18n_get function, elefantcms will translate words using the language file. But if it is hard coded in template file, it will not.

    Not only these, admin toolbar labels will also not be translated, because they are formed in a different way. They are defined in apps/{$appname}/conf/config.php.

    Words in template can easily be changed to support mulit language, but it seems that words in apps need a solution to solve the problem. Can I call a php function in an INI-style file?

    A solution: in config.php file, use {"...some words"}, then when parse the file, convert to use i18n_get function to get right value.

    Another solution: each app has a lang folder, and also some language files. When admin install the app, append the language file content to the main file.

    The first solution can easily work, but after you install a new app, you should modify the main language file to add new translation content manually.

    The second needs admin app to append contents while installing and remove contents while uninstalling. It seems that now elefantcms doesn't have uninstall event right now, but it should. Using this can also help apps stand alone.

  • 'Import Posts' is not in new_lang.php 'Choose an importer' is not in new_lang.php 'importer' of 'Blogger importer' is not translatable 'export file' of 'Blogger export file:' is not translatable 'Drag pages here to remove them from the tree.' is not in new_lang.php 'Add User' is not translatable

    as to 1.4 mail stone, data/time format must be translatable

    many wards on date/time picker are not translatable

    On editor, 'Blod', 'Italic'....terms are not translatable

  • where is 1.4?


    It said about mail stone 1.4

    And now I translated elafant cms. The three reasons.

    1. for Japanese users.

    2. it said 'needed tester', so I used and tested.

    3. On the same page above, it said 'Contributing ... Translate Elefant into more languages'

    I knew elefant used Javascritp(JQuery). If I want, I will read and I can change everything personally. But there is no benefit for other(want to translate in own language).

    So who will make decision how and what will change or translate is not me. It is developers' decision.

    So if you don't want help about translation and find bugs and improvement translation system, let's me know. In future, elefant get more futures and I will feel enough. When the time come, I will fork and make elefant-ja, and translated hard coding string into Japanese.

  • Hi, I was away all yesterday and I'm just catching up on this thread. I'll write some info in the documentation on making translations and post it here soon too.

    I fixed 2 things just now so the latest code in Github now has these fixes:

    1. The translation building utility (./conf/elefant build-translation) wasn't reading sub-folders in the handlers and views folders, so views/file.html could be translated but not views/sub/file.html. That's been fixed now so everything should be able to be translated.
    2. The Tools menu items weren't being translated before, but now they're passed correctly to the i18n_get() function.

    I've also filed a bug about the web installer not being translatable yet:

    What I planned to build for Elefant 1.4 was a Translations option under the Tools menu where you could easily manage translations and make new ones. For now, it's only by editing the files in the lang folder, but that will improve :)

    Once I post the translation page in the documentation area, I'll take a look at what else is missing that you guys have mentioned here.

    Thanks for the help, I really appreciate it and would love to see Elefant working nicely in multiple languages!

  • Ah there is a page (although it could use some editing to make it easier to follow) about how Elefant's translations work:

  • Hi

    I read the document.

    If possible, please think about auto detect language by browser info. like:

    function get_lang_from_browser_setting() { if (!isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { // only IE can be set no default language... return 'en-US'; } else { // on windows, when using xammp, make error because comment out extension intl.dll (on above 5.3, it must include as default...) return Locale::acceptFromHttp($_SERVER['HTTP_ACCEPT_LANGUAGE']); }; }

    and for setlocal :

    function get_local() { if (PHP_OS === 'WINNT' or PHP_OS === 'WIN32') { return ''; } else { return get_lang_from_browser_setting(); } }

    I don't know it is better 'en' or 'en-US' format.

    In language.php defined default and fallback language, so you need mode work out around here.

    Maybe it is the best way to make auto-language-detect option for system. And set fallback language as defined in language.php. And On as default. I think.

    In future, it must be handle priority for language...

    1. user setting
    2. browser setting
    3. default setting / fallback setting
  • There is a setting to use the Accept-Language header. In conf/config.php you can change this setting to http and it will use your browser's language preferences to choose the best language to display:

    ; This is the method for determining which language to show the
    ; current visitor. Options are: url (e.g., /fr/), subdomain
    ; (e.g.,, http (uses Accept-Language header),
    ; or cookie.
    negotiation_method = url

    I do wonder which one should be the default setting. Currently it is url but there may be a better option.

  • I just finished fixing two of the big remaining translation issues: translating the web installer, and making the wysiwyg editor show with the right translation. I've also updated the lang/new_lang.php file to include the missing text, and changed the language checking to use the Accept-Language header by default.

    There may still be a few places that are missing translatable text, but this should get us much closer to being complete. I would love to see Elefant ship with multiple languages supported out of the box :)

  • I've written a new translator tool for Elefant's GUI that will hopefully make it easier to translate it into other languages. It's now in the master branch on Github. I moved the latest beta release into the 1.2 branch, so new features like the translator tool can be worked on in the master branch. If you install from Github master, you'll see it under Tools > Languages.

    I've also included the translations you guys have made, so hopefully they can be the start of making Elefant multilingual for everyone.

  • I will make a new chinese language file in a few days :)

  • Hi folks. Anybody else working on a german translation? I'm half the way through and it will be finished tomorrow. Could use some proof reading and a way to submit the file. Shall I fork on git-hub and raise a pull-request or what's the preferred way to do that?

    About the default setting for the negotiation method - I like http, because the Accept-Language header is - imho - the best way to do that automagically. Just my 5 cents.

  • Hi erschum, I believe you're the only one working on German :) Thank you for that!

    To send the translation, you can either paste the files (e.g., lang/de.php and lang/languages.php) into a site like or you can fork and submit a pull request through the Github website. The process for that would be:

    1. On the Elefant Github repository, click 'Fork'
    2. Do a git clone of your forked repository
    3. Make your changes (adding the translation file and settings)
    4. Commit via git add lang/de.php; git commit -m "..." lang; git push origin master
    5. On Github, click 'Pull Request' and submit
Sign In or Register to comment.