Home » Internationalization » Translation2 » Bug #10086
Container gettext is missing a way to set default langID on the getOne method
Details
| Submitted | 2007-02-13 14:38 UTC |
|---|---|
| From | tobias at graficonn dot no |
| Assigned | quipo |
| Status | No Feedback |
| Package | Translation2 |
| PHP Version | 5.2.0 |
| OS | Any |
| Roadmaps | (Not assigned) |
Comments
[2007-02-13 14:38 UTC] tobias at graficonn dot no
Description:
------------
The gettext container for this packages is missing a way to set the default langID in the getOne method. It seems that this only applies to the gettext container.
Patch for a fix is included in the Test script field of this form.
Test script:
---------------
274a275,280
> // Set language
> $langID = $this->_getLangID($langID);
> if (PEAR::isError($langID)) {
> return $langID;
> }
>
[2007-02-13 15:26 UTC] tobias at graficonn dot no
I'm using the File_Gettext module, and not "native" mode, by setting the parameter "blank_on_missing" to true. The way I've understood the documentation, you don't need to specify $langID on the get-method, as long as you have set the language to be used.
Example:
-----------------------------------------
$params = array(
'prefetch' => false,
'langs_avail_file' => 'languages.ini',
'domains_path_file' => 'domains.ini',
'default_domain' => 'default',
'blank_on_missing' => true
);
$t =& Translation2::factory('gettext', $params);
$t->setLang('no');
print $t->get('Main menu');
-----------------------------------------
This should print out "Hovedmeny" as it is specified in my locale files, but instead it just prints the default value of "Main menu". With my patch applied to the gettext container, it figures out what language ID to use, and it works just fine.