Jump to:

3434 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » sapphire/javascript/lang/en_US.js

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

Page: 1
Go to End
Author Topic: 1630 Views
  • Tonyair
    Avatar
    Community Member
    81 Posts

    sapphire/javascript/lang/en_US.js Link to this post

    Hello,
    I added mysite/javascript/lang/ru_RU.js and flushed website, but still sapphire/javascript/lang/en_US.js load?

    public function init() {
    ...
    Requirements::clear();
    }

    doesn't help

  • Tonyair
    Avatar
    Community Member
    81 Posts

    Re: sapphire/javascript/lang/en_US.js Link to this post

    and as addition how to form structure like that:
    <% if Object.Method() == bla-bla %>
    <% end_if %>

    i know that i can use:
    <% control Object %>
    <% if Method() == bla-bla %>
    <% end_if %>
    <% end_contol %>
    but it looks odd

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: sapphire/javascript/lang/en_US.js Link to this post

    I think I'm having similar issue here. Am on SS 2.4.0

    Have added $SearchForm in my template and in _config.php:

    FulltextSearchable::enable();
    Translatable::set_default_locale('nl_NL');
    Object::add_extension('SiteTree', 'Translatable');
    i18n::set_locale('nl_NL');

    Have added following line in mysite/lang/nl_NL.php:

    <?php
    $lang['nl_NL']['SearchForm']['SEARCH'] = 'Test';
    ?>

    Now on the site (even with ?locale=nl_NL) the default search form value is taken from saphire/lang/nl_NL.php and not from mysite/lang/nl_NL.php. Newly created $lang rows (i.e. lang definitions not present in saphire/lang/nl_NL.php) in mysite/lang/nl_NL.php do work however.

    Is it not possible to overload saphire/lang/nl_NL.php?

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: sapphire/javascript/lang/en_US.js Link to this post

    PS. This is in my Page.php:

    public function init() {
    parent::init();
    // Set locale
    if($this->dataRecord->hasExtension('Translatable')) {
    i18n::set_locale($this->dataRecord->Locale);
    }
    ...

  • Tonyair
    Avatar
    Community Member
    81 Posts

    Re: sapphire/javascript/lang/en_US.js Link to this post

    It's default locale as fallback: sapphire/javascript/i18n.js but u can block it Requirements::block('sapphire/javascript/i18n.js');

    Requirements::add_i18n_javascript('<my-module-dir>/javascript/lang');

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: sapphire/javascript/lang/en_US.js Link to this post

    Fixed this by creating folder zlang in root. Contents of this folder is empty _config.php (with <?php ?>) and lang folder with language files. Think I found this trick on ssbits.

    1630 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.