"Cocostudio game development of the four" Ui.json image internationalization

Source: Internet
Author: User

COCOS2DX 3.0 CocoStudio1.4.1


Do interface when using the Cocostudio generated Ui.json file, need to do language localization, forum friends gave the method:

The localization of the picture format, in English called Button_store_normal.en.png Chinese called button_store_normal.zh.png ...

According to this rule, load different pictures according to the language you need.


We're using a different approach:

Modify the JSON file, this is not the real modification of the JSON file, just after reading the JSON file into memory, not immediately handed over to the Guireader generation widget, but in accordance with the desired language, replace the corresponding resource path in the JSON file


The resource directory is as follows:

Resource/data/ui.json

Resource/data/pic //ui.json Use of the image directory without localization

Resource/data/local_en//Storage of the English version of the picture resources

Resource/data/local_zh//Storage of Chinese version of picture resources

......


The JSON file is as follows:

  "Texturespng": ["Pic/ui/weaponscene/bg.png", "Pic/ui/weaponscene/weapon_sel_close.png", "pic/ui/weaponscene/we Apon_sel_close1.png "," Pic/ui/weaponscene/slider_bar.png "," Pic/ui/weaponscene/slider_btn.png "," Pic/ui/weaponsce    Ne/weapon_sel_bg.png "," Pic/weapon_1.png "," Pic/ui/bullet_flag.png "," Pic/ui/weaponscene/money_buy_bullet.png ", "Pic/ui/weaponscene/money_buy_bullet1.png", "Local_en/weapon_select_scene/jiemian_upgrade_5.png", "local_en/ Weapon_select_scene/jiemian_upgrade_5_1.png "," Pic/ui/weaponscene/progress2.png "," pic/ui/weaponscene/ Progress1.png "," Pic/ui/weaponscene/progress.png "," Local_en/weapon_select_scene/jiemian_sttack_4.png "," local_en /weapon_select_scene/jiemian_xuanzhong_6_5.png "," Local_en/weapon_select_scene/jiemian_xuanzhong_6_6.png "," Local_en/weapon_select_scene/jiemian_xuanzhong_6_7.png "," Local_en/weapon_select_scene/jiemian_xuanzhong_6_8. PNG "," Local_en/weapon_select_scene/jiemian_go.png "," LoCal_en/weapon_select_scene/jiemian_go_1.png "," Local_en/weapon_select_scene/jiemian_shop.png "," Local_en/weapon_ Select_scene/jiemian_shop_1.png "...],

Pic/ui/*.png is not required for multi-lingual processing

Local_en/*.png is our default Design language directory

After reading the Ui.json file, we replace "local_en/" with the language we need, such as "local_zh/", and the rest is to determine the language of the problem.


If you have a better idea, share it with me.


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.