zend-translate

Zend Framework: Zend_translate and routing related issue

亡梦爱人 提交于 2019-12-12 18:40:49
问题 I have implemented Zend_Navigation, Zend_Translate in my application. The routing is setup in Bootstrap.php like below. $fc = Zend_Controller_Front::getInstance(); $zl=new Zend_Locale(); Zend_Registry::set('Zend_Locale',$zl); $lang=$zl->getLanguage().'_'.$zl->getRegion(); $router = $fc->getRouter(); $route = new Zend_Controller_Router_Route(':lang/:module/:controller/:action/*', array( 'lang'=>$lang, 'module'=>'default', 'controller'=>'index', 'action'=>'index' )); $router->addRoute('default'

override gettext .mo files

ⅰ亾dé卋堺 提交于 2019-12-10 14:18:45
问题 For translations in our application, we're using Zend Translate with the gettext adapter. In each module is a folder translations , containing .mo files for all the languages; da.mo nl.mo en.mo Which are scanned and added through the addTranslation() method: if ( is_dir( $translations_dir ) ) { foreach ( new DirectoryIterator( $translations_dir ) as $file ) { if ( substr( $file, -3 ) == '.mo' ) { $ZendTranslate->addTranslation( $file->getPathname(), $file->getBasename('.mo') ); } } } The

Translation of database with poedit and zend translate

独自空忆成欢 提交于 2019-12-10 10:08:56
问题 Poedit does not automatically recognise the content of a table in a database. What is the best way to get the content of a table recognized by poedit for its translation in zend. I would like it to be done automatically....do I have to create an xml file from the database ? 回答1: You should not translate database contents with poedit. You would do that inside the database. The short answer: what you want cannot be achieved, unfortunately. You can translate "fixed" strings and if you want to

What's the best option to have language switcher in my ZF2 system?

百般思念 提交于 2019-12-08 10:14:05
问题 I have developed small ZF2 doctrine system for one of my client. All is good so far, but they require the system in 2 languages. I can set default language as english or another language from my module/Application/config/module.config.php 'translator' => array( 'locale' => 'en_US', 'translation_file_patterns' => array( array( 'type' => 'gettext', 'base_dir' => __DIR__ . '/../language', 'pattern' => '%s.mo', ), ), ), And I also can use this method to set default in module.php public function

Mysql adapter for Zend_Translate

流过昼夜 提交于 2019-12-07 04:56:55
问题 I'm currently in the planning phase of a rather large project that I'll develop in the Zend Framework. One of the problems I'm facing is that the customers will want to translate not only the content but also the interface. I'm currently using gettext and poedit to manage my language files but this is not an option for the customer as they, for one, wont have FTP access to the site. Hence, I'm thinking of a mysql back end with an interface in the front end for the customer to manage his own

Translation of database with poedit and zend translate

你离开我真会死。 提交于 2019-12-06 01:33:57
Poedit does not automatically recognise the content of a table in a database. What is the best way to get the content of a table recognized by poedit for its translation in zend. I would like it to be done automatically....do I have to create an xml file from the database ? You should not translate database contents with poedit. You would do that inside the database. The short answer: what you want cannot be achieved, unfortunately. You can translate "fixed" strings and if you want to get variables, constant or database values translated, you have to do that via literal string translations, in

Use PHP Gettext without having to install locales

只谈情不闲聊 提交于 2019-12-04 17:30:43
问题 I've been looking at options for internationalizing an open source project: Gettext, which everyone seems to recommend, apparently needs locales to be "installed on your system" to be used. See this note on the PHP manual, which reflects exactly my situation. This SO question also asks about the same problem. This isn't suitable for an open source project because I can't trust that the end users have the appropriate locales installed on their system. Besides, it's very very weird that you

Use PHP Gettext without having to install locales

a 夏天 提交于 2019-12-03 12:20:51
I've been looking at options for internationalizing an open source project: Gettext, which everyone seems to recommend, apparently needs locales to be "installed on your system" to be used. See this note on the PHP manual, which reflects exactly my situation. This SO question also asks about the same problem. This isn't suitable for an open source project because I can't trust that the end users have the appropriate locales installed on their system. Besides, it's very very weird that you have to install locales just to use strings that you've translated (IMO). Zend_Translate is also

Zend Framework 2 - Translate Standard Form Validation and Error messages

给你一囗甜甜゛ 提交于 2019-11-30 15:36:26
I'm writing a complete German application and therefore need to set basically everything to German. My question: What is the best and easiest way to set for example the form validation to German? I found this page but couldn't figure out how to get this code working: Zend_Validate_Abstract::setDefaultTranslator($translate); Could anyone give me some advice how to use this? Edit: Thanks to @Gordon I put the following into my Application/Module.php: use Zend\I18n\Translator\Translator; use Zend\Validator\AbstractValidator; class Module { public function onBootstrap(MvcEvent $e) { ... $translator

Multilingual Site in Zend Framework

我们两清 提交于 2019-11-30 09:36:32
问题 i am working on a site to include Multilingual Support. I can translate strings using Zend_Translate but what about the content?? For example do i have to add multiple records for same product's for each language? Or is there any other way? I am new to multilingual please help. Thanks in advance. --- Addition ----------------------------- Ok, i decided to use a mixed solution to use google translation api and storing it in database for further editing. So what sould be the structure of