.mo file support in CodeIgniter |
I'm making Composer packages for CodeIgniter and next step is to translate them into few languages using .mo files.
Let me explain why .mo is important: * Easier standard to work with across companies. Approach i came up with is: 1. In router allow for CI {locale} definition. 2. In Config/App.php we set defaultLocale to 'en' but fill up supportedLocales with all .mo files that are present. 3. In Language/en/Sample.php whe have something like this: PHP Code: <?php I looked up system/Language/Language.php:134 which is a fallback to English language -when requested one is not found- thus this greeting should get triggered from lang('Sample.GreetingText'); Question/Problem: I can't find if CodeIgniter does set up Environment for .mo files and if not or what-not then does anyone get the picture i'm trying to achieve and have any suggestions of what could i try?
This would never be put into the framework this is an addon to the application.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Alright i solved my issue. So what helped me alot was https://stackoverflow.com/questions/1949...le-locales this MoParser class.
I have set up a little helper that is linked to service which has a MoParser Factory attached (so to save memory). Here's the helper: PHP Code: if (! function_exists('l')) And this is the .mo file factory which is called by the helper to return translations. PHP Code: <?php Hope these snippets help anyone stuck with including .mo files!
And like I mentioned above an addon Library.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |