You are making a great application why limit it to one language!
You will find language resources under
languages/XX
Language file must follow the name of the controller
You can copy EN folder to create your own ES/ DE / NO / FI /JP /TH or any other.
All utf8 languages are supported, but beware BOM is evil and can make Ajax calls fail, apparently it send some header info before when the file is included so just save your files without BOM
Let's make our language file,
Please create
language/EN/categories.php
1 <?php 2 global $lang; 3 #-------------------- TITLE FIELDS ----------------------------- 4 $lang["title"] = "Categories Maintenance"; 5 6 #----------- TAGS FOR INPUT FIELDS ----------------------------- 7 $lang["label"]["lbl_I_NAME"] = "Category name"; 8 9 #----------- HEADER FOR LIST COLUMNS --------------------------- 10 $lang["list_header"]["im_recipes"] = "See recipes!"; 11 ?>
Again we were feeling lazy assigning every define for language files, so we decide the way to use "pseudo-inheritance" was to use an array, there is a global language file that defines most buttons, error messages, navigation labels, etc.
Language entries are grouped in arrays, so for example:
All buttons are part of $lang['btn'] array,
All messages are part of $lang["msg"] array
While for buttons it make no sense to apply all together, all labels can be assigned in one go saving a lot of effort. it also contributes to the application looking more standard and we avoid loading gigantic language files (1 file per application) while reusing the labels
The global language file is : general_lang.php
Finally finished! You got a categories page, now let's make recipes a little bit faster before you fly away