Marcos wrote on 01 mrt 2005 in comp.lang.javas cript:
[color=blue]
> I need to translate the messages of mine scripts, as I can make
> professionally this working with the pair php and javascript?[/color]
Translate as in:
alert('Hi folks')
to
alert('Bonjour a tous')
?
If so what is your question?
--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)
"Marcos" <me@privacy.net > wrote in message
news:opsmyxcaz9 44nt1j@rogerio. network...[color=blue]
> My question is, how do it with php and javascript, but the website it
> goes to have many languages.
>
> Thank's.
>
> Marcos
>
> Em 01 Mar 2005 14:18:09 GMT, Evertjan. <exjxw.hannivoo rt@interxnl.net >
> escreveu:
>[color=green]
>> Translate as in[/color][/color]
The other thing to do is to use PHP to determine the language and
dynamically write the correct client-side script:
<?php
// figure out what language the user is using
if (they are using french) {
$greeting = "french";
} else if (they are using english) {
$greeting = "english";
}
<script type="text/javascript">
alert('<?php echo $greeting ?>');
</script>
I'd prefer the second method because then you don't need to dump all the
localization resources to the client, you only produce the localization
values you need.
--
Grant Wagner <gwagner@agrico reunited.com>
comp.lang.javas cript FAQ - http://jibbering.com/faq
Em Tue, 01 Mar 2005 20:01:37 GMT, Grant Wagner
<gwagner@agrico reunited.com> escreveu:
[color=blue]
> "Marcos" <me@privacy.net > wrote in message
> news:opsmyxcaz9 44nt1j@rogerio. network...[color=green]
>> My question is, how do it with php and javascript, but the website it
>> goes to have many languages.
>>
>> Thank's.
>>
>> Marcos
>>
>> Em 01 Mar 2005 14:18:09 GMT, Evertjan. <exjxw.hannivoo rt@interxnl.net >
>> escreveu:
>>[color=darkred]
>>> Translate as in[/color][/color]
>
> In index.html.en you'd have:
>
> <script type="text/javascript">
> var localizationRes ources = [ 'Hi folks', 'whatever', 'whatever' ];
> </script>
>
> In index.html.fr you'd have:
>
> <script type="text/javascript">
> var localizationRes ources = [ 'Bonjour a tous, 'whatever', 'whatever' ];
> </script>
>
> In all files you'd have:
>
> <script type="text/javascript">
> function greeting()
> {
> alert(localizat ionResources[0]);
> }
> // ...
> </script>
>
> The other thing to do is to use PHP to determine the language and
> dynamically write the correct client-side script:
>
> <?php
> // figure out what language the user is using
> if (they are using french) {
> $greeting = "french";
> } else if (they are using english) {
> $greeting = "english";
> }
> <script type="text/javascript">
> alert('<?php echo $greeting ?>');
> </script>
>
> I'd prefer the second method because then you don't need to dump all the
> localization resources to the client, you only produce the localization
> values you need.
>[/color]
Comment