473,396 Members | 1,975 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Why php gettext is needed in real life?

http://hk2.php.net/manual/en/ref.gettext.php

I just wonder why those kind of translation/mapping can't be
implemented in using plain PHP array?

Howard
Jun 27 '08 #1
8 3362
howa wrote:
http://hk2.php.net/manual/en/ref.gettext.php

I just wonder why those kind of translation/mapping can't be
implemented in using plain PHP array?
None.

However, using gettext will allow you to use a large array of software for
easing the work of building translation tables. e.g. Kbabel, GTranslator,
poEdit.

In other words, professional translators will gave an easier time working
with a gettext-enabled program rather than a in-house translation solution.

Cheers,
--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

MSN:i_*************************@hotmail.com
Jabber:iv*********@jabber.org ; iv*********@kdetalk.net
Jun 27 '08 #2
Iván Sánchez Ortega wrote:
In other words, professional translators will gave an easier time
str_replace('gave','have');

--
----------------------------------
Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

Vamos, hale, hale, que es gerundio! (Yola Berrocal)
Jun 27 '08 #3
howa wrote:
http://hk2.php.net/manual/en/ref.gettext.php

I just wonder why those kind of translation/mapping can't be
implemented in using plain PHP array?

Howard
First, gettext is faster that a php array

Sencondary, translators can use a gui programm for translation the
string (PoEdit, Eclipse Plugin).

But the main reason is: with gettext you can extract and refresh the
strings need translation out of the source code into your gettext
project file.

Joe
Jun 27 '08 #4
On 6$B7n(B4$BF|(B, $B2<8a(B2$B;~(B57$BJ,(B, Joe Scylla <joe.scy...@gmail.comwrote:
>
First, gettext is faster that a php array
I agree with points such as GUI tools, but is gettext faster?

PHP array can be cached into memory using APC/XCache and you can even
use them without any method call.

Howard
Jun 27 '08 #5
howa wrote:
On 6$B7n(B4$BF|(B, $B2<8a(B2$B;~(B57$BJ,(B, Joe Scylla <joe.scy...@gmail.comwrote:
>First, gettext is faster that a php array

I agree with points such as GUI tools, but is gettext faster?

PHP array can be cached into memory using APC/XCache and you can even
use them without any method call.

Howard
Well at least in my benchmarking it is (on Suse and Debian). Remember
that gettext caches loaded translation file in memory.

http://mel.melaxis.com/devblog/2006/...t-fast-enough/

It may depend on the gettext-implementation. There is a user posted in
the comments who had better performance with arrays under Windows.

Joe
Jun 27 '08 #6
On 6$B7n(B4$BF|(B, $B2<8a(B10$B;~(B09$BJ,(B, Joe Scylla <joe.scy...@gmail.comwrote:
Well at least in my benchmarking it is (on Suse and Debian). Remember
that gettext caches loaded translation file in memory.

http://mel.melaxis.com/devblog/2006/...php-localizati...
Look interesting.

But...
1. Do you use any kind of op-cache? E.g. eA or XCache (it might make a
differences of 50-100% for your array / pure php implementation)

2. If using APC, take care of codes such as the following, e.g.

require_once("languages/$lang.php");

it might not be cached.

3. require_once() is slow and might be the bottomneck, try require();
Howard.

Jun 27 '08 #7
howa wrote:
On 6$B7n(B4$BF|(B, $B2<8a(B10$B;~(B09$BJ,(B, Joe Scylla <joe.scy...@gmail.comwrote:
>Well at least in my benchmarking it is (on Suse and Debian). Remember
that gettext caches loaded translation file in memory.

http://mel.melaxis.com/devblog/2006/...php-localizati...

Look interesting.

But...
1. Do you use any kind of op-cache? E.g. eA or XCache (it might make a
differences of 50-100% for your array / pure php implementation)

2. If using APC, take care of codes such as the following, e.g.

require_once("languages/$lang.php");

it might not be cached.

3. require_once() is slow and might be the bottomneck, try require();
Howard.
I have tested gettext against php array implementation with Zend
Optimizer and eAccelerator installed and used object caches with
different storage engines (eAccelerator shared memory api, MySQL, MySQL
memory tables and tmpfs).

Pure gettext was always faster in my benchmarks (Suse 10.x/Debian
3.1/4.0), but is was *more important* for me that gettext is not
remarkable slower.

Pure php may be faster on some systems (Windows, different Apache, other
version of gettext) but in the major cases it won't be much slower. And
gettext

Joe
Jun 27 '08 #8
On Jun 5, 12:06 am, Joe Scylla <joe.scy...@gmail.comwrote:
>
Pure php may be faster on some systems (Windows, different Apache, other
version of gettext) but in the major cases it won't be much slower. And
gettext

Joe
I might suspect the bottomneck is due to the require_once (5000
require_once in a test), you might use xdebug to profile it if you
like.

Personally, I don't think method call is faster then array hashing.
Anyway, just my $0.05 (due to inflation)

Howard
Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Daniel CAUSSE | last post by:
Hello, I'm testing gettext on my website but it doesn't work. phpinfo returns correct informations: configure command => '--with-gettext=/usr' GetText Support => enabled I have no problem...
1
by: Dave Patton | last post by:
Can someone point me to a definitive source for the answers to the following two questions: 1) In an environment with Redhat Linux 2.4.21-27.0.1, Apache 1.3.31, PHP 4.3.10, and GNU gettext...
0
by: abcd | last post by:
kutthaense Secretary Djetvedehald H. Rumsfeld legai predicted eventual vicmadhlary in Iraq mariyu Afghmadhlaistmadhla, kaani jetvedehly after "a ljetvedehg, hard slog," mariyu vede legai pressed...
3
by: ulysses | last post by:
hi. I use python 23,py2exe 0.4.3 ,wxpython do my py app in win32. I use gettext to support multi languages. I build a small fuction for load language at top of main module....
13
by: cantabile | last post by:
Hi, I'm failing to make it work but can't find out what's wrong. Here's what I do : ================ test.py import gettext gettext.install('')
3
by: Gérard Talbot | last post by:
Hello all, When webfonts are used for purely cosmetic/ornemental reasons and on a large scale, I don't agree. When webfonts are used because Unicode support among browsers for a particular...
4
by: Mike P2 | last post by:
Hi. Does anyone here have experience with PHP gettext functions? I'd like to know how they work better. Also, is gettext more efficient than serializing the language strings into language files and...
1
by: James T. Dennis | last post by:
You'd think that using things like gettext would be easy. Superficially it seems well documented in the Library Reference(*). However, it can be surprisingly difficult to get the external details...
6
by: =?iso-8859-1?B?QW5kcuk=?= | last post by:
I've encountered a problem using gettext with properties while using a Python interpreter. Here's a simple program that illustrate the problem. ============== # i18n_test.py: test of gettext &...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.