Jump to:

1844 Posts in 1600 Topics by 559 members

Blog Module

SilverStripe Forums » Blog Module » blog module in other languages

Discuss the Blog Module.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2132 Views
  • jmperea
    Avatar
    Community Member
    5 Posts

    blog module in other languages Link to this post

    Hello:

    I have installed blog module blog-v0.2.1, in my _config.php i put this:

    i18n::enable();
    i18n::set_default_lang('es');
    i18n::set_locale('es_ES');

    In the top of the file of translation, es_ES.php,

    there are this sentence:

    i18n::include_locale_file('modules: blog', 'en_US')

    This code generate this error:

    Warning: array_key_exists() [function.array-key-exists]: The second argument should be either an array or an object in /var/www/virtual/alhaurinjoven.com/htdocs/prueba/SilverStripe-v2.3.2/blog-v0.2.1/lang/es_ES.php on line 19

    if i change the las last code, and i put this:

    i18n::include_locale_file('blog-v0.2.1', 'en_US');

    The cms don´t have any error, but not translate in spanish.

    The variable $lang contains the array es_Es, because if i do print_r(es_Es);

    example: [es_ES] => Array ( [ArchiveWidget] => Array ( [DispBY] => .........

    I put in /mysite/_config.php,

    i18n::enable();
    i18n::set_locale('es_ES');
    i18n::set_default_lang('es');

    cms/_config.php,

    i18n::enable();
    i18n::set_locale('es_ES');

    sapphire/_config.php

    i18n::set_locale('es_ES');

    And the blog module doesn`t traslate in spanish, i need help to do this.

    Tank you.

    Sorry for my english.

    bye

  • baba-papa
    Avatar
    Community Member
    279 Posts

    Re: blog module in other languages Link to this post

    Hi jmperea,

    if you install any module you have the change the folders name. The folder "blog-v0.2.1" must be renamed to just "blog". The same with all other modules.

  • dacar
    Avatar
    Community Member
    168 Posts

    Re: blog module in other languages Link to this post

    hi, i have got the same problem. the warning is really a problem, because it increases the size of the error.log file very much.

    in php5_error.log it says:

    [13-Oct-2009 00:05:28] PHP Warning: array_key_exists() [<a href='function.array-key-exists'>function.array-key-exists</a>]: The second argument should be either an array or an object in /home/31/xyz/silverstripe/blog/lang/de_DE.php on line 13

    Here is the code from /blog/lang/de_DE.php:

    i18n::include_locale_file('modules: blog', 'de_DE');

    global $lang;

    if(array_key_exists('de_DE', $lang) && is_array($lang['de_DE'])) {
       $lang['de_DE'] = array_merge($lang['en_US'], $lang['de_DE']);
    } else {
       $lang['de_DE'] = $lang['en_US'];
    }

    _config.php:

    i18n::enable();
    i18n::set_locale('de_DE');
    i18n::set_default_lang('de');
    //Object::add_extension('SiteTree', 'Translatable');
    //Translatable::set_default_locale('de_DE');

    Hope anybody can help.

    2132 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.