eZ Community » Forums » Developer » Use i18n in php
expandshrink

Use i18n in php

Use i18n in php

Monday 06 December 2010 7:04:05 am - 3 replies

Hello eZ riders,

My question is very simple yet i did not find the right resource.

I need to translate text in a php module using the same mechanism as the i18n operator but i can't find the way to make this code work properly :

$language = ezcurrentLanguage();            
if ( $language != "eng-GB" )
{
$file = 'translation.ts';
$ini = eZINI::instance();
$useCache = $ini->variable( 'RegionalSettings', 'TranslationCache' ) != 'disabled';
eZTSTranslator::initialize( $context, $language, $file, $useCache );
$man = eZTranslatorManager::instance();
$newValue = $man->translate( $context, $value, $comment );
if ( $newValue )
{
$value = $newValue;
}

Thanks

Modified on Monday 06 December 2010 7:06:53 am by Paul Etienney

Monday 06 December 2010 8:29:22 am

Hello,

Check the file kernel/common/ezpi18n.php ( tr function) happy.gif Emoticon

Friday 24 December 2010 5:58:02 pm

Shame on me ! It was soooooooo easy !

If you want to user the i18n operator in php module just do this :

eZTranslateText( 'contextName', 'text to translate');

And that's it !

Merry Christmas.

Modified on Friday 24 December 2010 5:58:56 pm by Paul Etienney

Friday 24 December 2010 8:16:26 pm

Shame on me ! It was soooooooo easy !

If you want to user the i18n operator in php module just do this :

eZTranslateText( 'contextName', 'text to translate');

And that's it !

Merry Christmas.

Merry Christmas to you too !

But...i could not get a hold on this eZTranslateText function (4.4) happy.gif Emoticon

I usually use the following :

ezpI18n::tr( $context, $source, $comment = null, $arguments = null )

Cheers !

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from