I'm using php-gettext instead of the native php gettext extension. I was wondering if there was a better way of translating tons of text. For example, I have this bit of code:
<h4 class="blue2"><?php print T_("Saiba a todo o instante onde se encontram as viaturas da organização e garanta um serviço mais eficaz aos seus clientes.") ?></h4>
<h4><?php print T_("ECONOMIZE:") ?></h4>
<ul>
<li><strong><?php print T_("Combustível") ?></strong><br>
<?php print T_("Mudança de hábitos de condução, otimização de rotas, controlo de velocidade e RPM") ?></li>
<li><strong><?php print T_("Comunicações") ?></strong><br>
<?php print T_("Ferramentas que substituem a comunicação por voz com o condutor") ?></li>
<li><strong><?php print T_("Recursos") ?></strong><br>
<?php print T_("Gestão de prazos de manutenção e obrigações fiscais") ?></li>
<li><strong><?php print T_("Tempo") ?></strong><br>
<?php print T_("Interpretação rápida da localização e estado de toda a frota") ?></li>
<li><strong><?php print T_("Emissão de CO<sup>2</sup>") ?></strong><br>
<?php print T_("Ecodriving") ?>
I have tons of <?php print T_("...") ?>
, and it doesn't seem eficient. And in my messages.po, I have this:
msgid "Saiba a todo o instante onde se encontram as viaturas da organização e garanta um serviço mais eficaz aos seus clientes."
msgstr "Real time location of light and heavy vehicles. <br>Save fuel, time, communication with drivers, vehicles' maintenance and CO<sup>2</sup> emissions.<br>Optimize your resources and ensure your clients a more effective service."
msgid "ECONOMIZE:"
msgstr "SAVE:"
msgid "Combustível"
msgstr "Fuel"
msgid "Mudança de hábitos de condução, otimização de rotas, controlo de velocidade e RPM"
msgstr "change in driving habits, routing optimization, speed and RPM control"
msgid "Comunicações"
msgstr "Communications"
msgid "Ferramentas que substituem a comunicação por voz com o condutor"
msgstr "GPRS communication with drivers on the road, reducing voice calls and SMS"
msgid "Recursos"
msgstr "Resources"
msgid "Gestão de prazos de manutenção e obrigações fiscais"
msgstr "term maintenance and tax obligations, direct communication avoiding manual entry"
msgid "Tempo"
msgstr "Time"
msgid "Interpretação rápida da localização e estado de toda a frota"
msgstr "real time vehicle location, quick interpretation of the fleet’s status"
msgid "Emissão de CO<sup>2</sup>"
msgstr "CO<sup>2</sup> emissions"
msgid "Ecodriving"
msgstr "Ecodriving"
And I have a lot of pages with much more information than this, and it's proving quite tiring to do this in every page. It will take me days and my sanity if I have to do it this way. Is there a better way of doing?
In these cases you can avoid using gettext. You can use a different files for each language, using some naming convention to help you determine which of the files should be used.
So for example, you'll have somefile_en.php for english, somefile_es.php for spanish, etc.