Page 1 of 1

define variables

Posted: Fri Sep 21, 2007 11:40 am
by xaicks
hi ppl!!!

how can i define variables for languages translate!!!
E.g. i want to add some text´s in product area, and when i click in the flag it translates

Sorry i think that is very easy, but i don´t find it!!!

Thanks

Re: define variables

Posted: Fri Sep 21, 2007 7:00 pm
by nde
You add languages to the catalog/language/ folder. Then, in the admin, you need to add these languages via Admin > Config > Localization > Languages.

Then you're able to add different languages when adding/editing products.

Re: define variables

Posted: Fri Sep 21, 2007 9:39 pm
by xaicks
i dont want to add languages, but words in my site, it´s simple to add text but i want translate this words when i click in the flag!!

Thanks

Re: define variables

Posted: Sat Sep 22, 2007 2:11 am
by nde
Ok, I got you wrong there. Don't know how to add words that will translate outside the product description, etc...
Maybe you can start looking how things like box headers etc. are handled right now.

Re: define variables

Posted: Sat Sep 22, 2007 4:32 am
by luvz2drv
make a copy of the english one..
change the words you want
when they click the flag it will switch out the words


the LANGUAGE files are the control for that...

Re: define variables

Posted: Sat Sep 22, 2007 11:38 pm
by d77
it sounds like you need multiple language support, which opencart provides, however to support multiple languages you need to create the language package, as well as enter all your product data in multiple languages.

i have worked with similar features on another project where its not a full language replacement, but more of an individual word replacement using one language. however, i don't quite get how this would apply in a shop.

if you need something other than multiple language support, can you supply a specific example that applies to your business so we can understand the requirement a bit better?

Re: define variables

Posted: Sun Sep 23, 2007 12:56 am
by nde
No I think he needs to add more words that translate 'out of the box'. Some that are not in the language files and not needed for Opencart.

xaicks:
Look at a language php file and see how different words are defined.
These get read from within the backend in this form:

Code: Select all

$language->get('button_add_to_cart'));
So if you define your own variable in the language files they should be available in any template file:

Code: Select all

<?php echo $language->get('my_own_variable')) ?>
PS: not tested that yet though!

Re: define variables

Posted: Tue Sep 25, 2007 8:29 am
by xaicks
Hi,

In language/portuguese/controller/product.tpl i have this


In template/default/content/product.tpl i want to put the variable and the result is this notice
Notice: Undefined variable: text_descr in /hermes/web10/b1117/pow.lusotekops16/htdocs/pakiee/catalog/template/default/content/product.tpl on line 26
how can i define variables?
Thanks ppl!

Re: define variables

Posted: Tue Sep 25, 2007 1:24 pm
by luvz2drv
you need to set it to the template...

part one of what you have done is good... :)

now part 2

file you need to edit

/catalog/controller/product.php          load('controller/product.php');

add this...

$view->set('text_descr', $language->get('text_descr'));


save and you should be good to go

Re: define variables

Posted: Wed Sep 26, 2007 8:32 am
by xaicks
yeah!!

Thanks Ppl!!  ;D