CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 [SOLVED] Can I use variables with $CCSLocalesGetText()?

Print topic Send  topic

Author Message
joejac

Posts: 242
Posted: 03/24/2009, 2:24 PM

Hello,

I am trying to change what comes from a database field, that I know it is a fixed set of text values, each one is one of my "translation key", and I want to change them for its translations, so in BeforeShowRow event I do:

global $locale;
global $CCSLocales;
$state = $Component->state_name->GetValue();
$state_translation = $CCSLocales->GetText($state, ' ') ;
$Component->state_name->SetValue($state_translation);

It do not make the translation, it keeps the original value from the DB field, but if I manually change
GetText($state, ' ') for the name of one of the translation key: GetText('state1_trans_name', ' ') it works.

1.- Does this function only accept text and do not accept variables?
2.- How can I do this?
3.- Where I can find the detailed documentation for all CCS4 functions?

Thanks a lot
Best regards
joejac
View profile  Send private message
melvyn


Posts: 333
Posted: 03/24/2009, 3:01 PM

If the variable contains a string, the function must accept it. Anyways, PHP is a untyped language, so no matter if you pass 1, '1', or $myvar = 1
Anyways, try this line:
  
$state_translation = $CCSLocales->GetText("$state", ' ') ;  
  
AND this another:  
  
$state_translation = $CCSLocales->GetText("   '$state'  ", ' ') ;  
// please note: you must remove spaces between single and double quotes.  
  
// The above can also be:  
$state_translation = $CCSLocales->GetText("  \"$state\"  ", ' ') ;  
// revove spaces too  

If you enter a $var inside a double quotes as "$var" it's value is exploded inside. inserting the single quote ' inside the double quote " will pass the value with the quotes.

  
$var = "Melvyn";  
echo $var;   
   => Melvyn  
  
echo "  '$var'  ";   
   =>  'Melvyn'   
  
echo " \" $var \" ";  
  => "Melvyn"  
  
:-D
_________________
Melvyn Perez
Puro Codigo
http://purocodigo.com
View profile  Send private message
joejac

Posts: 242
Posted: 03/24/2009, 4:57 PM

Thanks a lot for your help Melvyn, it works half.

I tried all your recommendations and something strange happens. The rows with background color blank are translated, but those alternate rows with the alternative background color (a light green with my style) do not change, it seems they do not carry out the event instructions, they only shows the database field text, not the corresponding translation.

What can be the problem? it looks like something is in conflict between "Alternate Records" and the execution of this code inside BeforeShowRow event.

Does anybody knows what is happening, or what am I doing wrong?

Best regards
joejac
View profile  Send private message
joejac

Posts: 242
Posted: 03/25/2009, 10:38 AM

Hello,

Thanks to Melvyn and finally to Yes Support that explained to me that: "the controls in alternative row has different names, like alt_state_name. You can check it in Project Explorer window. In case different controls are used you need to change the values of state_name or alt_state_name control depending on grid's row."

So I repeated the above instructions for alt_state_name control also, and it worked perfect.

Best regards
joejac
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.