![]() |
Language class suggestion .. - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Language class suggestion .. (/showthread.php?tid=35890) |
Language class suggestion .. - El Forum - 11-14-2010 [eluser]Ramania[/eluser] Some of you guys are so lucky for not having to work with the language class, the language class it self is very straight forward and simple, i have no issues with it at all except for a small suggestion that i find very useful for those of us who create sites with a primary language then secondary languages (Arabic, French, Urdu ..etc). and before i start i would say this feature might been implemented in CI but it skipped my attention, i won't feel stupid because it didn't require a lot of time at all. this is an extract from the language class Code: function line($line = '') I am suggesting something very simple, a parameter that allows the class to return the line used instead of FALSE or return FALSE if this parameter is not set to TRUE an example would illustrate .. Code: <?=$this->lang->line('About us');?> it's written in English .. spaced beautiful English, why would i have an English file for something already written in English? whatever happened to DRY? so simply Code: <?=$this->lang->line('About us',TRUE);?> would return the $lang variable which is 'About us' in case it's not found! ... Code: function line($line = '', $return_original = FALSE) won't that save the developer/designer/translator time? anyways i know it's best practice to extend the controller rather than changing it, so in case of a CI patch/update i won't lose my modifications and i won't comprise the integrity of the system classes, but i went ahead and allowed my self to modify it to return the $lang variable instead of false by default... so far so good, if i'd see any side effects or "artifacts" ![]() ps: i'm lately trying to payback to the CI community, so if my paybacks aren't useful to you i apologize, my intentions are good. edit : i forgot to mention that writing something like Code: <?=$this->lang->line('About us') ? $this->lang->line('About us') : 'About us';> Isn't very "sexy" or practical either .. Rami. |