0

Hello,

I'm coding a site in php, and i want to add another language/

I used poedit to do po file

I used the _e() func, e.g _e('hello world')

but when i tried to run the site in the localhost, i get an error.

but when i changed the func, i used th _() Func, it's work fine.


What's the problem ?

Thank you

Tito

4
Contributors
9
Replies
14
Views
5 Years
Discussion Span
Last Post by diafol
0

Hello,

for example
this code

<?php _e('hello world') ?>

doesn't work, and i get this error.

undefined function _e().

when i change it to this code:

<?php echo _('hello world') ?>

it working, and I get the translation

0

This works for me:

<?php
function _e($w) # define function
{
	return 'hello ' .$w;
}

echo _e('world');
?>

Now: are you loading your _e() function? is this _e() a po function? Are you using php.ini extension directive to load it? bye

0

Hello,

I want to translate "hello world" in another language by po file and the _e() is a po function

0

It's not clear to me. PHP is noticing you that _e is not defined, my question are:

1. where is located _e() function? in which file?
2. how do you include it to your script?

This <?php _e('hello world') ?> by itself can't work.

0

the e() function is in the *.po file.

this is the code to excute it
$locale = "ar_SA";
if (isSet($_GET["locale"])) $locale = $_GET["locale"];
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
$domain='sanapix';
bindtextdomain($domain, "./languages");
textdomain($domain);
?>

and yes, it's wordpress thing, but also it's working in another apps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.