idh63
Posts: 76
|
| Posted: 03/04/2008, 9:16 AM |
|
Hi there,
I am having a merry time with translations. I am so thrilled at the capabilites for translation.
I got stumped on this though:
I want some custom image buttonsnin various forms and i am not getting how to get the correct button image based on the locale.Do I have to manipulate the url somehow?
e.g. I have a button that I created in the Styles | Buttons:
FileName------------------------------------ButtonText
ButtonNewPaymentMethod-------------{res:button_new_method}
So how do I call the filename in a way that will pick up the correct folder name for the image file?
e.g. /styles/stylename/en/ButtonNewPaymentMethod.gif
vs /styles/stylename/es/ButtonNewPaymentMethod.gif
Thanks
|
 |
 |
datadoit
|
| Posted: 03/04/2008, 10:06 AM |
|
To start, verify that you mean you're using a Button style, as in:
..en_button {
background: transparent url(en_image.gif) no-repeat center top;
}
Secondly, make a copy of that class in your stylesheet for your translation:
..es_button {
background: transparent url(es_image.gif) no-repeat center top;
}
Finally, use the template variable to alter which style class to use.
In the HTML for the button:
<!-- BEGIN Button YourButton --><input class="{YourStyle}" type="submit" ...
Then, in the button's BeforeShow event:
global $Tpl;
if (CCGetParam("locale","")=="es" OR CCGetSession("locale","")=="es") {
$Tpl->SetVar("YourStyle", "es_button");
}
else { //the default language
$Tpl->SetVar("YourStyle", "en_button");
}
That's just one way to skin this cat.
|
|
|
 |
wkempees
Posts: 1679
|
| Posted: 03/04/2008, 12:01 PM |
|
Huh???
In ProjectSetting->Styles press the 'Buttons' Button
In the resulting Buttons dialogue, press the Use Translations Button.
Now define any new buttons you might be using with any text you want them to use as {res:yourdesiredtext}
When done press OK
Back in ProjectSetting->Styles press Rebuild, just to be sure, then press OK
Now go to either Locales&Encoding or Project Explorer->Resources
and ad the proper {res:...} and all the (translations) prompts.
All your buttons will be generated for you.
Go back as often as needed as long as you remeber to publish all files.
Or did I get your question wrong?
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
datadoit
|
| Posted: 03/04/2008, 12:58 PM |
|
Me thinks his issue was using a button image (not text).
Probably something like a PayPal button (?).
|
|
|
 |
wkempees
|
| Posted: 03/04/2008, 1:16 PM |
|
oh ok.
Well I spilt the milk anyway, and a Paypal could be done just as well, lol
"datadoit" <datadoit@forum.codecharge> schreef in bericht
news:fqkd5n$dsa$2@news.codecharge.com...
> Me thinks his issue was using a button image (not text).
>
> Probably something like a PayPal button (?).
|
|
|
 |
idh63
Posts: 76
|
| Posted: 03/10/2008, 5:54 PM |
|
Hi Guys,
Thanks for the replies. Sorry for taking so long to reply.
Thanks Walter for your detailed response. I had already done all that. What I am not getting is which language to I choose when I place a graphical button on the page? I have to choose an image. I have the button (as an image) in the styles/en, styles/es, styles/ru, and styles/it.
Do I use the one that is in the en folder? (default)
Thanks
|
 |
 |
datadoit
|
| Posted: 03/10/2008, 6:24 PM |
|
Page BeforeShow:
global $Tpl;
$Tpl->SetVar("locale",CCGetSession("locale","en"));
Your button's image source:
styles/{locale}
|
|
|
 |
|