Bryan Lee Posted March 29, 2013 Share Posted March 29, 2013 (edited) How to make another language pack for official installation process? Could you guide me collaborate and help me in some way. Ex: I want to make Vietnam lang for official installation process. Should I will do? What files must edit? Many thanks and appreciate. Edited March 29, 2013 by Bryan Lee (see edit history) Link to comment Share on other sites More sharing options...
djfm Posted March 29, 2013 Share Posted March 29, 2013 (edited) Hello Bryan, Thanks for your interest in this subject, that is a very good question! Since you want to make an installer for Vietnamese, I'll use Vietnamese as the example language. Here is how to proceed! The following is based on PrestaShop 1.5.4.0, some parts may not work for earlier versions of PrestaShop. I’ll assume that you have PrestaShop extracted to some directory, let’s say "/var/www/prestashop", and that you access it through the URL http://localhost/prestashop. First, we’ll put the necessary file structure in place go to your install directory (“/var/www/prestashop/install”, or “/var/www/prestashop/install-dev” if you have a development version) in the “langs” folder, duplicate the “en” folder and rename it to “vn” in the “fixtures/apple/langs” folder, duplicate the “en” folder and rename it to “vn” [*]in your “langs/vn/img” folder, rename all the files subsituting the “en” prefix with “vn” : for instance “en-default-category.jpg” becomes “vn-default-category.jpg”. Under linux you could for instance run the following command: for i in en*; mv $i `echo $i | sed 's/en/vn/'` Second, we’ll set the new language’s details Edit the file “langs/vn/language.xml” and put the appropriate values. Instead of: <?xml version="1.0" encoding="UTF-8"?> <language> <name><![CDATA[English (English)]]></name> <language_code>en-us</language_code> <date_format_lite>m/j/Y</date_format_lite> <date_format_full>m/j/Y H:i:s</date_format_full> <is_rtl>false</is_rtl> </language> We will write: <?xml version="1.0" encoding="UTF-8"?> <language> <name><![CDATA[tiếng Việt (Vietnamese)]]></name> <language_code>vn-VN</language_code> <date_format_lite>m/j/Y</date_format_lite> <date_format_full>m/j/Y H:i:s</date_format_full> <is_rtl>false</is_rtl> </language> and save the file. Inside the <name></name> tag the first “English” is the language name in the language itself and the second one is the language name in English. The only missing thing at this point is the flag. Find a flag (for instance on wikipedia), resize it to 16x11px and replace the “langs/vn/flag.jpg” file with your flag. Under linux, if you have ImageMagick installed you can do so from the command line: wget http://upload.wikimedia.org/wikipedia/commons/thumb/2/21/Flag_of_Vietnam.svg/200px-Flag_of_Vietnam.svg.png convert -resize 16x11 200px-Flag_of_Vietnam.svg.png flag.jpg Here is what the installer looks like now: At this point, you should perform the installation and check that it completes successfully. If not, you probably did something wrong like forgetting to rename all the images... please go back up and check everything! Third, if the installation succeeded, you can start translating! Here is how: go to http://localhost/prestashop/install/dev/translate.php, select “vn” in the dropdown, and translate! The “submit” button is at the bottom of the page. Save your work regularly. once this is done, open the file “langs/vn/install.php” with a text editor, and complete the few translations that are not present in the interface : search for ‘menu_welcome’, ‘menu_license’, ‘menu_system’, ‘menu_database’, ‘menu_configure’ and ‘menu_process’. They are usually at the beginning of the file. Take care of escaping all the single quotes with backslashes if you use some in the translation! Adjust the informations block if needed. Last (but not least) steps There are many things we did not translate yet, they are contained in the XML files: “langs/vn/data/*.xml” : those are the most important, open them in a code editor and translate the contents (everything that looks like real English sentences, not the tags or attributes names!), but pay attention not to translate anything that is an ID! If unsure what to translate in those files, ask away! “fixtures/apple/langs/vn/*.xml” : same principle as above, these are the translations of the demo products. the images : there are images in “langs/vn/img”. Some of them contain English text, edit them with your favorite image editor. Advice: Try installing PrestaShop regularly while you translate, so that if the installation fails you will find more easily what change caused it to fail! Once you have done all this please share your work with the community by contacting translation@prestashop.com !! (or just make a pull request) You can ask all you questions here if you have any! Good luck! Edited March 29, 2013 by fmDejouv (see edit history) 1 Link to comment Share on other sites More sharing options...
Bryan Lee Posted March 31, 2013 Author Share Posted March 31, 2013 @ fmDejouv: Many thanks for the quick response and your very detailed article. I had to complete follow you guide but I found all tab in BO not not the same as what I have translated in tab.xml, may be when I install the system had call another tab.xml file from prestashop.com. I try to find out error but I can't, so I want to ask you one thing is particularly countries like Vietnam, it has 2 separate code for language and territory. For country code, Vietnam code is "vn", (http://en.wikipedia....wiki/ISO_3166-1) , but Vietnam languages code is "vi" (http://en.wikipedia....ISO_639-1_codes). So that, could you edit your article where use "vn" and where use "vi". And I found the great error, great bug of ver 1.5.4.0 that when I add new language complete, ex. English then the page reload admin login page, after re-login, I saw Warning: array_key_exists() [function.array-key-exists]: The first argument should be either a string or an integer in .... \prestashop\classes\shop\Shop.php on line 753. After that, I can't access many tab with Fire Fox and all tab with IE browser, ex: 1. Tab Product, I see blank page with: Fatal error: Cannot access empty property in ... \prestashop\classes\Product.php on line 2485 2. Tab Categories, I can't. 3. ect. And most especially, I can't change language from Vietnam to English and vice versa (the Save button not effect) in My preferences. I had try re-install many time by change English and Vietnamese in Choose your language step but that error still exist. Could you help me out off all problem or could you say this for people who have the authority to fix it. I had report this problem at http://forge.prestashop.com/browse/PSCFV-8534. Regards, P/s: I attach here my tab.xml file for you test it. tab.xmlFetching info... Link to comment Share on other sites More sharing options...
Bryan Lee Posted March 31, 2013 Author Share Posted March 31, 2013 And after that the FO show: Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file 'D:\MyWeb\1540FINAL/themes//maintenance.tpl'' in D:\MyWeb\1540FINAL\tools\smarty\sysplugins\smarty_internal_templatebase.php:127 Stack trace: #0 D:\MyWeb\1540FINAL\tools\smarty\sysplugins\smarty_internal_templatebase.php(374): Smarty_Internal_TemplateBase->fetch('D:\MyWeb\1540FI...', NULL, NULL, NULL, true) #1 D:\MyWeb\1540FINAL\classes\controller\Controller.php(357): Smarty_Internal_TemplateBase->display('D:\MyWeb\1540FI...') #2 D:\MyWeb\1540FINAL\classes\controller\FrontController.php(582): ControllerCore->smartyOutputContent('D:\MyWeb\1540FI...') #3 D:\MyWeb\1540FINAL\classes\controller\FrontController.php(396): FrontControllerCore->displayMaintenancePage() #4 D:\MyWeb\1540FINAL\classes\controller\Controller.php(150): FrontControllerCore->init() #5 D:\MyWeb\1540FINAL\classes\Dispatcher.php(349): ControllerCore->run() #6 D:\MyWeb\1540FINAL\index.php(28): DispatcherCore->dispatch() #7 {main} thrown in D:\MyWeb\1540FINAL\tools\smarty\sysplugins\smarty_internal_templatebase.php on line 127 Link to comment Share on other sites More sharing options...
djfm Posted April 10, 2013 Share Posted April 10, 2013 Quote So that, could you edit your article where use "vn" and where use "vi". No, I won't edit, because in PrestaShop, the language code of Vietnames is "vn", not "vi", sorry PrestaShop sometimes deviates from the standards for various reasons but now it is too late to change everything. Please try again with "vn" as language code, maybe that is why some things fail (the installer expects the language pack to be on prestashop.com, else you need to put the gzip in your "translations" folder. Link to comment Share on other sites More sharing options...
Recommended Posts