2

I am planning on developing a bilingual PHP app with Agile Toolkit, with a language selector on every page ( French & English ) .. Can ATK4 accommodate this ? I am thinking yes .. but .. how would a newbie like me go about this with ATK4 ?? any cues would be greatly appreciated... I wish to create one single file ( some kind of database file that holds the translations) and access everything through variables for the various page views ( even the menu items ). Any assistance or cues on this will be greatly appreciated. thx

Don

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114

1 Answers1

1

PHP already have the localization function, and all you need to do is make sure that all the internal messages of Agile Toolkit is being routed through the localization function. Agile Toolkit's API contains a _() method too. You need to re-define it inside your "lib/Frontend.php" and route it either through the get text or SQL, whichever way you want.

The other big part of translation you will need to perform is template translation. Templates usually contain graphics and texts which may be different depending on language. The "PathFinder" is ideal for this. Agile Toolkit website actually uses that technique for Polish translation:

as you pass 3nd argument to the constructor, it instructs PathFinder to look into a different directory for the localized template files. If it does not find them there, it defaults to regular locations.

Community
  • 1
  • 1
romaninsh
  • 10,606
  • 4
  • 50
  • 70
  • Thank u Romaninsh .. so to wrap up : I'll change the function you pointed out to me like this "function _($str){ return gettext($str); }" for the translation of all text to be shown in the app . But for the template translation the "Pathfinder" would be the ideal way to go ! If I have trouble with the "Pathfinder" method, I'll give you a shout ! .. as I am still trying to figure it out ! .. thanks again .. you are a real prince. – user1204626 Feb 23 '12 at 04:26
  • Thank u Romaninsh .. so to wrap up : besides english, I have to have French available ( french Canadian oblige) so I'll change the function you pointed out to me like this "function _($str){ putenv('LC_ALL=fr_CA'); setlocale(LC_ALL,'fr_CA'); bindtextdomain("my_App_mo_file", "./locale"); textdomain("my_App_mo_file"); return gettext($str); }" for the translation of all text to be shown in the app . Does that seem right? thanks again – user1204626 Feb 23 '12 at 04:50
  • It's been a while since I was making multi-lingual apps, but it seem Ok. If you have any suggestions or problems along the way, contact me through developer's mailing list. – romaninsh Feb 23 '12 at 10:20