Agile Toolkit localization

2019-05-31 04:52发布

问题:

I read the answer here for a question about bilingual atk, but I wonder if the framework is adapted for international use?

I tested the CRUD functionality (v 4.2) and cannot see that e.g. the labels of the buttons (Add, Edit, Delete) are run through the _() function.

Any plans for that? If needed and ATK is the right path, could I assist? If so how?

回答1:

Here is the most recent localization branch.

https://github.com/atk4/atk4/tree/locale

they call $this->api->_() which you can override and make it call _() or any other way.

$this->add('translation/Controller_Basic')
    ->setLocale('de')                      // default language
    ->setModel('translation/Translation'); // use your model if you wish

$this->routePages('translation');          // adds translation/admin page

$this->add('Button')->setLabel('Localization Test');

If you use the translation controller with debug argument, it will add smileys to all the non-localized strings:

$this->add('translation/Controller_Basic',array('debug'=>true))

Records which has no translation will be automatically added through the model.



标签: atk4