Getting things multilingual
If you have install version 1.1.6 or later you will be able to use the multilingual functionality for all your projects. Here is how it works.
Step 1. First of all make sure that you have copied all the files of grocery CRUD in your project. Even if you update from older version, make sure that you copy ALL the files and folders to your project. If you just copy the library and/or the model , probably you will not be able to use this functionality
Step 2. Go to application/config/grocery_crud.php and select you own language. The available languages are: Afrikaans, Arabic, Bulgarian, Chinese, Danish, Dutch, English, French, German, Greek, Indonesian, Italian, Japanese, Persian, Polish, pt-BR.portuguese, pt-PT.portuguese, Romanian, Russian, Spanish, Thai, Turkish, Ukrainian, Vietnamese.
Step 3. It's that simple. Now when you change for example the config to "greek", you will see all the CRUD grid and forms to be translated to greek. But what if someone want to add his own language? Go to step 4, below
Step 4 - Adding your own language. The languages folder is at: your_project/assets/grocery_crud/languages/ ( The languages are in different folder that codeigniter uses. The main reason is to be absolutely independent from the language functionality of CI. This means that even if you have an update at codeigniter, or you add your own MY_Language , grocery CRUD will still works the same.) There you can add your own language by naming it with the name that you want to call it at the application/config/grocery_crud.php .
When you have done your file will look like the this:
So let's have an example that you add your own language and named it "spanish.php", you can go straight away to your application/config/grocery_crud.php and change it to:
<?php $config['grocery_crud_default_language'] = 'spanish';
If you still want more...
The new multilingual functionality offers you also two amazing functions.
- set_language. You can simply change your language at your method. So for example in your project if you have the default language to "greek" you can have one situation that you don't want to have the default language but another, just type $crud->set_language("english"). And you will have English only at this method.
- set_lang_string. Set your lang string directly. This is really useful if you want just for some cases to change the language string.