Please look at my newly maded website, pure RoR, not used Globalization
For translation used: xml file system..
Please look at my newly maded website, pure RoR, not used Globalization
For translation used: xml file system..
Hello,
in rails_root i have "langs" folder that contain, en.xml, ru.xml .. etc, mean can contain any language..
In site admin there is language controller that can add new language, like name, code (2 letters like "en" < this will be name of flag (in images) and name of xml file).
in xml structure are like this:
<?xml version="1.0" encoding="cp1251" ?> <language id="ru"> <def w="One">Один</def> <def w="Click Here">Нажмите тут</from> </language>
in application.rb there is before_filter to init language.. from lib/ language.rb language.rb is exttending String class so if you want to put translated string make <%= "One".tr %>
In application.rb there is preloader for all current language strings, if no translation was given for "ru", then it use "en" as default... If <%= "This is not exist".tr %> string not exist - everything will fall
I thinked to make mysql driven translation plugin with generator of controller so u can translate easily.. etc.. got everything almost working except time,