a bilingual application on Agile Toolkit ? with language selector for the user?

回眸只為那壹抹淺笑 提交于 2019-12-24 04:52:10

问题


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


回答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:

  • https://github.com/atk4/atk4-web/blob/master/lib/AgileToolkitWeb.php#L8
  • https://github.com/atk4/atk4-web/blob/master/main.php

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.



来源:https://stackoverflow.com/questions/9252573/a-bilingual-application-on-agile-toolkit-with-language-selector-for-the-user

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!