SilverCart Forum

We moderate this Forum and we're here to help. Have you already run a forum search to check if your problem has already been solved?

You can help us helping you by providing detailed error messages, screenshots and logfile entries.

SebastianRamon

Page: 1
Topic Setting the language 2905 Views

Setting the language

14 March 2011 at 2:54am

Hi, I have been trying out Silvercart and very much like what you have done. (I didn't have great success with the ecommerce module).

Anyway, how and where do I set the language to English? No doubt it is staring me in the face but I cannot see how to do it.

Also, is there a smart(er) way to change "VAT" to "GST", for example, rather than editing individual files?

Re: Setting the language

14 March 2011 at 12:37pm Last edited: 15 March 2011 5:14pm

Hi mck,

to set the language to english, you have to add the following line to your project's _config.php (e.g. /mysite/_config.php):

// Set the site locale
i18n::set_locale('en_US');

After an initial /dev/build, SilverCart's sites and configurations should be created with the english language.

To use customized translations without changing the code of SilverCart, you can add this to your _config.php (this case expects your project's name to be 'mysite'):

i18n::register_plugin('mysite', 'getCustomTranslation', 100);
function getCustomTranslation() {
global $lang;
$lang['en_US']['SilvercartProduct']['VAT'] = 'GST';
$lang['en_US']['SilvercartPage']['INCLUDED_VAT'] = 'included GST';
$lang['en_US']['SilvercartPage']['TAX'] = 'incl. %s%% GST';
}

Regards,
Sebastian

Re: Setting the language

14 March 2011 at 8:54pm

Thanks Sebastian,

That function worked a treat!

Graeme McKinstry