Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

sapphire/javascript/lang/en_US.js


Go to End


6 Posts   2360 Views

Avatar
Tonyair

Community Member, 81 Posts

18 June 2010 at 1:02am

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

Avatar
Tonyair

Community Member, 81 Posts

18 June 2010 at 4:48am

Edited: 18/06/2010 4:49am

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

Avatar
klikhier

Community Member, 150 Posts

30 June 2010 at 9:27am

Edited: 30/06/2010 9:28am

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?

Avatar
klikhier

Community Member, 150 Posts

30 June 2010 at 9:44am

Edited: 30/06/2010 9:56am

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);
  }
...

Avatar
Tonyair

Community Member, 81 Posts

3 July 2010 at 8:16pm

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');

Avatar
klikhier

Community Member, 150 Posts

5 August 2010 at 1:16am

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.