├── .gitignore ├── .vscode └── launch.json ├── README.md ├── assets ├── Scene.meta ├── Scene │ ├── helloworld.fire │ └── helloworld.fire.meta ├── Script.meta ├── Script │ ├── HelloWorld.js │ └── HelloWorld.js.meta ├── Texture.meta ├── Texture │ ├── HelloWorld.png │ ├── HelloWorld.png.meta │ ├── singleColor.png │ └── singleColor.png.meta ├── resources.meta ├── resources │ ├── i18n.meta │ ├── i18n │ │ ├── en.js │ │ ├── en.js.meta │ │ ├── zh.js │ │ └── zh.js.meta │ ├── localized-image.meta │ └── localized-image │ │ ├── en.meta │ │ ├── en │ │ ├── home.png │ │ ├── home.png.meta │ │ ├── start.png │ │ └── start.png.meta │ │ ├── zh.meta │ │ └── zh │ │ ├── home.png │ │ ├── home.png.meta │ │ ├── start.png │ │ └── start.png.meta ├── testScene.fire └── testScene.fire.meta ├── creator.d.ts ├── jsconfig.json ├── project.json ├── settings ├── builder.json ├── builder.panel.json ├── i18n.json └── project.json ├── template-banner.png └── template.json /.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | library/ 6 | temp/ 7 | local/ 8 | build/ 9 | 10 | #///////////////////////////////////////////////////////////////////////////// 11 | # Logs and databases 12 | #///////////////////////////////////////////////////////////////////////////// 13 | 14 | *.log 15 | *.sql 16 | *.sqlite 17 | 18 | #///////////////////////////////////////////////////////////////////////////// 19 | # files for debugger 20 | #///////////////////////////////////////////////////////////////////////////// 21 | 22 | *.sln 23 | *.csproj 24 | *.pidb 25 | *.unityproj 26 | *.suo 27 | 28 | #///////////////////////////////////////////////////////////////////////////// 29 | # OS generated files 30 | #///////////////////////////////////////////////////////////////////////////// 31 | 32 | .DS_Store 33 | ehthumbs.db 34 | Thumbs.db 35 | 36 | #///////////////////////////////////////////////////////////////////////////// 37 | # exvim files 38 | #///////////////////////////////////////////////////////////////////////////// 39 | 40 | *UnityVS.meta 41 | *.err 42 | *.err.meta 43 | *.exvim 44 | *.exvim.meta 45 | *.vimentry 46 | *.vimentry.meta 47 | *.vimproject 48 | *.vimproject.meta 49 | .vimfiles.*/ 50 | .exvim.*/ 51 | quick_gen_project_*_autogen.bat 52 | quick_gen_project_*_autogen.bat.meta 53 | quick_gen_project_*_autogen.sh 54 | quick_gen_project_*_autogen.sh.meta 55 | .exvim.app 56 | 57 | #///////////////////////////////////////////////////////////////////////////// 58 | # webstorm files 59 | #///////////////////////////////////////////////////////////////////////////// 60 | 61 | .idea/ 62 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "Launch Main", 6 | "type": "node", 7 | "request": "launch", 8 | "stopOnEntry": false, 9 | "args": [ 10 | "./", 11 | "--dev", 12 | "/Users/nantas/fireball-x/demo-i18n" 13 | ], 14 | "cwd": "/Users/nantas/fireball-x/fbnew", 15 | "runtimeExecutable": "/Users/nantas/fireball-x/fbnew/bin/electron/Electron.app/Contents/MacOS/Electron", 16 | "runtimeArgs": [ 17 | ], 18 | "env": {}, 19 | "console": "internalConsole", 20 | "sourceMaps": false, 21 | "outDir": null 22 | } 23 | ] 24 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # i18n Demo for Cocos Creator 2 | 3 | This is a demo project for Cocos Creator i18n editor extension. 4 | 5 | Please read [i18n Readme](https://github.com/cocos-creator-packages/i18n) for details. -------------------------------------------------------------------------------- /assets/Scene.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "29f52784-2fca-467b-92e7-8fd9ef8c57b7", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Scene/helloworld.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_rawFiles": null, 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_name": "", 14 | "_objFlags": 0, 15 | "_opacity": 255, 16 | "_color": { 17 | "__type__": "cc.Color", 18 | "r": 255, 19 | "g": 255, 20 | "b": 255, 21 | "a": 255 22 | }, 23 | "_cascadeOpacityEnabled": true, 24 | "_parent": null, 25 | "_anchorPoint": { 26 | "__type__": "cc.Vec2", 27 | "x": 0, 28 | "y": 0 29 | }, 30 | "_contentSize": { 31 | "__type__": "cc.Size", 32 | "width": 0, 33 | "height": 0 34 | }, 35 | "_children": [ 36 | { 37 | "__id__": 2 38 | } 39 | ], 40 | "_localZOrder": 0, 41 | "_globalZOrder": 0, 42 | "_ignoreAnchorPointForPosition": false, 43 | "_tag": -1, 44 | "_opacityModifyRGB": false, 45 | "_id": "2d2f792f-a40c-49bb-a189-ed176a246e49" 46 | }, 47 | { 48 | "__type__": "cc.Node", 49 | "_name": "Canvas", 50 | "_objFlags": 0, 51 | "_opacity": 255, 52 | "_color": { 53 | "__type__": "cc.Color", 54 | "r": 252, 55 | "g": 252, 56 | "b": 252, 57 | "a": 255 58 | }, 59 | "_cascadeOpacityEnabled": true, 60 | "_parent": { 61 | "__id__": 1 62 | }, 63 | "_anchorPoint": { 64 | "__type__": "cc.Vec2", 65 | "x": 0.5, 66 | "y": 0.5 67 | }, 68 | "_contentSize": { 69 | "__type__": "cc.Size", 70 | "width": 960, 71 | "height": 640 72 | }, 73 | "_children": [ 74 | { 75 | "__id__": 3 76 | }, 77 | { 78 | "__id__": 6 79 | }, 80 | { 81 | "__id__": 8 82 | } 83 | ], 84 | "_rotationX": 0, 85 | "_rotationY": 0, 86 | "_scaleX": 1, 87 | "_scaleY": 1, 88 | "_position": { 89 | "__type__": "cc.Vec2", 90 | "x": 480, 91 | "y": 320 92 | }, 93 | "_skewX": 0, 94 | "_skewY": 0, 95 | "_localZOrder": 0, 96 | "_globalZOrder": 0, 97 | "_ignoreAnchorPointForPosition": false, 98 | "_tag": -1, 99 | "_opacityModifyRGB": false, 100 | "_id": "a286bbGknJLZpRpxROV6M94", 101 | "_active": true, 102 | "_components": [ 103 | { 104 | "__id__": 10 105 | }, 106 | { 107 | "__id__": 11 108 | } 109 | ], 110 | "_prefab": null 111 | }, 112 | { 113 | "__type__": "cc.Node", 114 | "_name": "background", 115 | "_objFlags": 0, 116 | "_opacity": 255, 117 | "_color": { 118 | "__type__": "cc.Color", 119 | "r": 27, 120 | "g": 38, 121 | "b": 46, 122 | "a": 255 123 | }, 124 | "_cascadeOpacityEnabled": true, 125 | "_parent": { 126 | "__id__": 2 127 | }, 128 | "_anchorPoint": { 129 | "__type__": "cc.Vec2", 130 | "x": 0.5, 131 | "y": 0.5 132 | }, 133 | "_contentSize": { 134 | "__type__": "cc.Size", 135 | "width": 960, 136 | "height": 640 137 | }, 138 | "_children": [], 139 | "_rotationX": 0, 140 | "_rotationY": 0, 141 | "_scaleX": 1, 142 | "_scaleY": 1, 143 | "_position": { 144 | "__type__": "cc.Vec2", 145 | "x": 0, 146 | "y": 0 147 | }, 148 | "_skewX": 0, 149 | "_skewY": 0, 150 | "_localZOrder": 0, 151 | "_globalZOrder": 0, 152 | "_ignoreAnchorPointForPosition": false, 153 | "_tag": -1, 154 | "_opacityModifyRGB": false, 155 | "_id": "e2e0crkOLxGrpMxpbC4iQg1", 156 | "_active": true, 157 | "_components": [ 158 | { 159 | "__id__": 4 160 | }, 161 | { 162 | "__id__": 5 163 | } 164 | ], 165 | "_prefab": null 166 | }, 167 | { 168 | "__type__": "cc.Widget", 169 | "_name": "", 170 | "_objFlags": 0, 171 | "node": { 172 | "__id__": 3 173 | }, 174 | "_enabled": true, 175 | "_alignFlags": 45, 176 | "_left": 0, 177 | "_right": 0, 178 | "_top": 0, 179 | "_bottom": 0, 180 | "_isAbsLeft": true, 181 | "_isAbsRight": true, 182 | "_isAbsTop": true, 183 | "_isAbsBottom": true, 184 | "_originalWidth": 200, 185 | "_originalHeight": 150 186 | }, 187 | { 188 | "__type__": "cc.Sprite", 189 | "_name": "", 190 | "_objFlags": 0, 191 | "node": { 192 | "__id__": 3 193 | }, 194 | "_enabled": true, 195 | "_spriteFrame": { 196 | "__uuid__": "410fb916-8721-4663-bab8-34397391ace7" 197 | }, 198 | "_type": 1, 199 | "_useOriginalSize": false, 200 | "_atlas": null 201 | }, 202 | { 203 | "__type__": "cc.Node", 204 | "_name": "cocos", 205 | "_objFlags": 0, 206 | "_opacity": 255, 207 | "_color": { 208 | "__type__": "cc.Color", 209 | "r": 255, 210 | "g": 255, 211 | "b": 255, 212 | "a": 255 213 | }, 214 | "_cascadeOpacityEnabled": true, 215 | "_parent": { 216 | "__id__": 2 217 | }, 218 | "_anchorPoint": { 219 | "__type__": "cc.Vec2", 220 | "x": 0.5, 221 | "y": 0.5 222 | }, 223 | "_contentSize": { 224 | "__type__": "cc.Size", 225 | "width": 195, 226 | "height": 270 227 | }, 228 | "_children": [], 229 | "_rotationX": 0, 230 | "_rotationY": 0, 231 | "_scaleX": 1, 232 | "_scaleY": 1, 233 | "_position": { 234 | "__type__": "cc.Vec2", 235 | "x": 0, 236 | "y": 50 237 | }, 238 | "_skewX": 0, 239 | "_skewY": 0, 240 | "_localZOrder": 0, 241 | "_globalZOrder": 0, 242 | "_ignoreAnchorPointForPosition": false, 243 | "_tag": -1, 244 | "_opacityModifyRGB": false, 245 | "_id": "c4f30YOS65G64U2TwufdJ+2", 246 | "_active": true, 247 | "_components": [ 248 | { 249 | "__id__": 7 250 | } 251 | ], 252 | "_prefab": null 253 | }, 254 | { 255 | "__type__": "cc.Sprite", 256 | "_name": "", 257 | "_objFlags": 0, 258 | "node": { 259 | "__id__": 6 260 | }, 261 | "_enabled": true, 262 | "_spriteFrame": { 263 | "__uuid__": "31bc895a-c003-4566-a9f3-2e54ae1c17dc" 264 | }, 265 | "_type": 0, 266 | "_useOriginalSize": true, 267 | "_atlas": null 268 | }, 269 | { 270 | "__type__": "cc.Node", 271 | "_name": "label", 272 | "_objFlags": 0, 273 | "_opacity": 255, 274 | "_color": { 275 | "__type__": "cc.Color", 276 | "r": 255, 277 | "g": 255, 278 | "b": 255, 279 | "a": 255 280 | }, 281 | "_cascadeOpacityEnabled": true, 282 | "_parent": { 283 | "__id__": 2 284 | }, 285 | "_anchorPoint": { 286 | "__type__": "cc.Vec2", 287 | "x": 0.5, 288 | "y": 0.5 289 | }, 290 | "_contentSize": { 291 | "__type__": "cc.Size", 292 | "width": 492, 293 | "height": 112 294 | }, 295 | "_children": [], 296 | "_rotationX": 0, 297 | "_rotationY": 0, 298 | "_scaleX": 1, 299 | "_scaleY": 1, 300 | "_position": { 301 | "__type__": "cc.Vec2", 302 | "x": 0, 303 | "y": -180 304 | }, 305 | "_skewX": 0, 306 | "_skewY": 0, 307 | "_localZOrder": 0, 308 | "_globalZOrder": 0, 309 | "_ignoreAnchorPointForPosition": false, 310 | "_tag": -1, 311 | "_opacityModifyRGB": false, 312 | "_id": "31f1bH7V69Ajr1iXhluMpTB", 313 | "_active": true, 314 | "_components": [ 315 | { 316 | "__id__": 9 317 | } 318 | ], 319 | "_prefab": null 320 | }, 321 | { 322 | "__type__": "cc.Label", 323 | "_name": "", 324 | "_objFlags": 0, 325 | "node": { 326 | "__id__": 8 327 | }, 328 | "_enabled": true, 329 | "_useOriginalSize": false, 330 | "_fontSize": 60, 331 | "_lineHeight": 60, 332 | "_enableWrapText": true, 333 | "_isSystemFontUsed": true, 334 | "_N$string": "Label", 335 | "_N$horizontalAlign": 1, 336 | "_N$verticalAlign": 1, 337 | "_N$overflow": 0 338 | }, 339 | { 340 | "__type__": "cc.Canvas", 341 | "_name": "", 342 | "_objFlags": 0, 343 | "node": { 344 | "__id__": 2 345 | }, 346 | "_enabled": true, 347 | "_designResolution": { 348 | "__type__": "cc.Size", 349 | "width": 960, 350 | "height": 640 351 | }, 352 | "_fitWidth": false, 353 | "_fitHeight": true 354 | }, 355 | { 356 | "__type__": "280c3rsZJJKnZ9RqbALVwtK", 357 | "_name": "", 358 | "_objFlags": 0, 359 | "node": { 360 | "__id__": 2 361 | }, 362 | "_enabled": true, 363 | "label": { 364 | "__id__": 9 365 | }, 366 | "text": "Hello, World!" 367 | } 368 | ] -------------------------------------------------------------------------------- /assets/Scene/helloworld.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "2d2f792f-a40c-49bb-a189-ed176a246e49", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/Script.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "4734c20c-0db8-4eb2-92ea-e692f4d70934", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Script/HelloWorld.js: -------------------------------------------------------------------------------- 1 | const i18n = require('LanguageData'); 2 | 3 | cc.Class({ 4 | extends: cc.Component, 5 | 6 | properties: { 7 | label: { 8 | default: null, 9 | type: cc.Label 10 | } 11 | }, 12 | 13 | // use this for initialization 14 | onLoad: function () { 15 | i18n.init('en'); 16 | this.label.string = i18n.t('label.hello'); 17 | }, 18 | 19 | // called every frame 20 | update: function (dt) { 21 | 22 | }, 23 | }); 24 | -------------------------------------------------------------------------------- /assets/Script/HelloWorld.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "280c3aec-6492-4a9d-9f51-a9b00b570b4a", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "subMetas": {} 8 | } -------------------------------------------------------------------------------- /assets/Texture.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "7b81d4e8-ec84-4716-968d-500ac1d78a54", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/Texture/HelloWorld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nantas/demo-i18n/1907aea1afcb2a4be975f5cea0762569ee27b63c/assets/Texture/HelloWorld.png -------------------------------------------------------------------------------- /assets/Texture/HelloWorld.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "HelloWorld": { 9 | "ver": "1.0.3", 10 | "uuid": "31bc895a-c003-4566-a9f3-2e54ae1c17dc", 11 | "rawTextureUuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 195, 20 | "height": 270, 21 | "rawWidth": 195, 22 | "rawHeight": 270, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/Texture/singleColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nantas/demo-i18n/1907aea1afcb2a4be975f5cea0762569ee27b63c/assets/Texture/singleColor.png -------------------------------------------------------------------------------- /assets/Texture/singleColor.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "singleColor": { 9 | "ver": "1.0.3", 10 | "uuid": "410fb916-8721-4663-bab8-34397391ace7", 11 | "rawTextureUuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": 0, 16 | "offsetY": 0, 17 | "trimX": 0, 18 | "trimY": 0, 19 | "width": 2, 20 | "height": 2, 21 | "rawWidth": 2, 22 | "rawHeight": 2, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/resources.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "71a88b50-5300-4d9a-876f-9c72b427ef28", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/resources/i18n.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "21730685-399a-4cdc-b102-044c92e7ca69", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/resources/i18n/en.js: -------------------------------------------------------------------------------- 1 | if (!window.i18n) window.i18n = {}; 2 | if (!window.i18n.languages) window.i18n.languages = {}; 3 | window.i18n.languages.en={ 4 | // write your key value pairs here 5 | label: { 6 | hello: 'Hello!', 7 | bye: 'Goodbye!' 8 | } 9 | }; -------------------------------------------------------------------------------- /assets/resources/i18n/en.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "e674f337-9d65-4593-8eef-39ae3021b1b5", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "subMetas": {} 8 | } -------------------------------------------------------------------------------- /assets/resources/i18n/zh.js: -------------------------------------------------------------------------------- 1 | if (!window.i18n) window.i18n = {}; 2 | if (!window.i18n.languages) window.i18n.languages = {}; 3 | window.i18n.languages.zh={ 4 | // write your key value pairs here 5 | label: { 6 | hello: '你好!', 7 | bye: '再见!' 8 | } 9 | }; -------------------------------------------------------------------------------- /assets/resources/i18n/zh.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.2", 3 | "uuid": "d16a96db-9398-447c-b35b-bce6304746a7", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "subMetas": {} 8 | } -------------------------------------------------------------------------------- /assets/resources/localized-image.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "02ee0bc3-5d01-4229-a6f0-14958b8187ad", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/resources/localized-image/en.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "3ffee1a5-49c4-4666-bf53-34a51f752de1", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/resources/localized-image/en/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nantas/demo-i18n/1907aea1afcb2a4be975f5cea0762569ee27b63c/assets/resources/localized-image/en/home.png -------------------------------------------------------------------------------- /assets/resources/localized-image/en/home.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "057b2100-d757-4a93-acd8-0d87db7bf5d3", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "home": { 9 | "ver": "1.0.3", 10 | "uuid": "10db723c-667b-4727-99a2-7adff08d3fc5", 11 | "rawTextureUuid": "057b2100-d757-4a93-acd8-0d87db7bf5d3", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -0.5, 16 | "offsetY": -3.5, 17 | "trimX": 14, 18 | "trimY": 31, 19 | "width": 141, 20 | "height": 45, 21 | "rawWidth": 170, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/resources/localized-image/en/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nantas/demo-i18n/1907aea1afcb2a4be975f5cea0762569ee27b63c/assets/resources/localized-image/en/start.png -------------------------------------------------------------------------------- /assets/resources/localized-image/en/start.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "ddc27e17-88dc-4d6b-8892-a2be082994a7", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "start": { 9 | "ver": "1.0.3", 10 | "uuid": "49d42084-afd0-44eb-862c-9381b64efbd3", 11 | "rawTextureUuid": "ddc27e17-88dc-4d6b-8892-a2be082994a7", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -1, 16 | "offsetY": -3.5, 17 | "trimX": 4, 18 | "trimY": 31, 19 | "width": 160, 20 | "height": 45, 21 | "rawWidth": 170, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/resources/localized-image/zh.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "587e52c8-67c1-4cc2-bf53-1cfc719661b3", 4 | "isGroup": false, 5 | "subMetas": {} 6 | } -------------------------------------------------------------------------------- /assets/resources/localized-image/zh/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nantas/demo-i18n/1907aea1afcb2a4be975f5cea0762569ee27b63c/assets/resources/localized-image/zh/home.png -------------------------------------------------------------------------------- /assets/resources/localized-image/zh/home.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "c179cb1e-0ae0-4d09-a238-1e1756886a36", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "home": { 9 | "ver": "1.0.3", 10 | "uuid": "89fffe72-3788-43a7-bc5b-97dd8f1c0caa", 11 | "rawTextureUuid": "c179cb1e-0ae0-4d09-a238-1e1756886a36", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -1, 16 | "offsetY": -3.5, 17 | "trimX": 43, 18 | "trimY": 30, 19 | "width": 82, 20 | "height": 47, 21 | "rawWidth": 170, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/resources/localized-image/zh/start.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nantas/demo-i18n/1907aea1afcb2a4be975f5cea0762569ee27b63c/assets/resources/localized-image/zh/start.png -------------------------------------------------------------------------------- /assets/resources/localized-image/zh/start.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "c1063bd2-c050-47b1-bcdd-8b45a60ee359", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "subMetas": { 8 | "start": { 9 | "ver": "1.0.3", 10 | "uuid": "3110e828-f9d6-4e47-a82f-e84520778a98", 11 | "rawTextureUuid": "c1063bd2-c050-47b1-bcdd-8b45a60ee359", 12 | "trimType": "auto", 13 | "trimThreshold": 1, 14 | "rotated": false, 15 | "offsetX": -0.5, 16 | "offsetY": -3, 17 | "trimX": 43, 18 | "trimY": 29, 19 | "width": 83, 20 | "height": 48, 21 | "rawWidth": 170, 22 | "rawHeight": 100, 23 | "borderTop": 0, 24 | "borderBottom": 0, 25 | "borderLeft": 0, 26 | "borderRight": 0, 27 | "subMetas": {} 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /assets/testScene.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_rawFiles": null, 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_opacity": 255, 15 | "_color": { 16 | "__type__": "cc.Color", 17 | "r": 255, 18 | "g": 255, 19 | "b": 255, 20 | "a": 255 21 | }, 22 | "_cascadeOpacityEnabled": true, 23 | "_parent": null, 24 | "_anchorPoint": { 25 | "__type__": "cc.Vec2", 26 | "x": 0, 27 | "y": 0 28 | }, 29 | "_contentSize": { 30 | "__type__": "cc.Size", 31 | "width": 0, 32 | "height": 0 33 | }, 34 | "_children": [ 35 | { 36 | "__id__": 2 37 | } 38 | ], 39 | "_localZOrder": 0, 40 | "_globalZOrder": 0, 41 | "_tag": -1, 42 | "_opacityModifyRGB": false, 43 | "_id": "1b1d7d36-5330-4bd5-b3f4-95a2982e1e2e", 44 | "autoReleaseAssets": false 45 | }, 46 | { 47 | "__type__": "cc.Node", 48 | "_name": "Canvas", 49 | "_objFlags": 0, 50 | "_opacity": 255, 51 | "_color": { 52 | "__type__": "cc.Color", 53 | "r": 255, 54 | "g": 255, 55 | "b": 255, 56 | "a": 255 57 | }, 58 | "_cascadeOpacityEnabled": true, 59 | "_parent": { 60 | "__id__": 1 61 | }, 62 | "_anchorPoint": { 63 | "__type__": "cc.Vec2", 64 | "x": 0.5, 65 | "y": 0.5 66 | }, 67 | "_contentSize": { 68 | "__type__": "cc.Size", 69 | "width": 960, 70 | "height": 640 71 | }, 72 | "_children": [ 73 | { 74 | "__id__": 3 75 | }, 76 | { 77 | "__id__": 6 78 | }, 79 | { 80 | "__id__": 11 81 | } 82 | ], 83 | "_rotationX": 0, 84 | "_rotationY": 0, 85 | "_scaleX": 1, 86 | "_scaleY": 1, 87 | "_position": { 88 | "__type__": "cc.Vec2", 89 | "x": 480, 90 | "y": 320 91 | }, 92 | "_skewX": 0, 93 | "_skewY": 0, 94 | "_localZOrder": 0, 95 | "_globalZOrder": 0, 96 | "_tag": -1, 97 | "_opacityModifyRGB": false, 98 | "_id": "b93c8iTrqdAqoTEpC1Niw17", 99 | "_active": true, 100 | "_components": [ 101 | { 102 | "__id__": 13 103 | }, 104 | { 105 | "__id__": 14 106 | } 107 | ], 108 | "_prefab": null, 109 | "groupIndex": 0 110 | }, 111 | { 112 | "__type__": "cc.Node", 113 | "_name": "staticLabel", 114 | "_objFlags": 0, 115 | "_opacity": 255, 116 | "_color": { 117 | "__type__": "cc.Color", 118 | "r": 255, 119 | "g": 255, 120 | "b": 255, 121 | "a": 255 122 | }, 123 | "_cascadeOpacityEnabled": true, 124 | "_parent": { 125 | "__id__": 2 126 | }, 127 | "_anchorPoint": { 128 | "__type__": "cc.Vec2", 129 | "x": 0.5, 130 | "y": 0.5 131 | }, 132 | "_contentSize": { 133 | "__type__": "cc.Size", 134 | "width": 120, 135 | "height": 40 136 | }, 137 | "_children": [], 138 | "_rotationX": 0, 139 | "_rotationY": 0, 140 | "_scaleX": 1, 141 | "_scaleY": 1, 142 | "_position": { 143 | "__type__": "cc.Vec2", 144 | "x": 0, 145 | "y": -136 146 | }, 147 | "_skewX": 0, 148 | "_skewY": 0, 149 | "_localZOrder": 0, 150 | "_globalZOrder": 0, 151 | "_tag": -1, 152 | "_opacityModifyRGB": false, 153 | "_id": "995caDF5C5HvI15arWXaL/J", 154 | "_active": true, 155 | "_components": [ 156 | { 157 | "__id__": 4 158 | }, 159 | { 160 | "__id__": 5 161 | } 162 | ], 163 | "_prefab": null, 164 | "groupIndex": 0 165 | }, 166 | { 167 | "__type__": "cc.Label", 168 | "_name": "", 169 | "_objFlags": 0, 170 | "node": { 171 | "__id__": 3 172 | }, 173 | "_enabled": true, 174 | "_useOriginalSize": false, 175 | "_actualFontSize": 40, 176 | "_fontSize": 40, 177 | "_lineHeight": 40, 178 | "_enableWrapText": true, 179 | "_N$file": null, 180 | "_isSystemFontUsed": true, 181 | "_N$string": "你好!", 182 | "_N$horizontalAlign": 1, 183 | "_N$verticalAlign": 1, 184 | "_N$overflow": 0 185 | }, 186 | { 187 | "__type__": "744dcs4DCdNprNhG0xwq6FK", 188 | "_name": "", 189 | "_objFlags": 0, 190 | "node": { 191 | "__id__": 3 192 | }, 193 | "_enabled": true, 194 | "_dataID": "label.hello" 195 | }, 196 | { 197 | "__type__": "cc.Node", 198 | "_name": "staticSprite", 199 | "_objFlags": 0, 200 | "_opacity": 255, 201 | "_color": { 202 | "__type__": "cc.Color", 203 | "r": 255, 204 | "g": 255, 205 | "b": 255, 206 | "a": 255 207 | }, 208 | "_cascadeOpacityEnabled": true, 209 | "_parent": { 210 | "__id__": 2 211 | }, 212 | "_anchorPoint": { 213 | "__type__": "cc.Vec2", 214 | "x": 0.5, 215 | "y": 0.5 216 | }, 217 | "_contentSize": { 218 | "__type__": "cc.Size", 219 | "width": 82, 220 | "height": 47 221 | }, 222 | "_children": [], 223 | "_rotationX": 0, 224 | "_rotationY": 0, 225 | "_scaleX": 1, 226 | "_scaleY": 1, 227 | "_position": { 228 | "__type__": "cc.Vec2", 229 | "x": -16, 230 | "y": 2 231 | }, 232 | "_skewX": 0, 233 | "_skewY": 0, 234 | "_localZOrder": 0, 235 | "_globalZOrder": 0, 236 | "_tag": -1, 237 | "_opacityModifyRGB": false, 238 | "_id": "19b6fJSphxBkZJ7SHFGbbF4", 239 | "_active": true, 240 | "_components": [ 241 | { 242 | "__id__": 7 243 | }, 244 | { 245 | "__id__": 8 246 | } 247 | ], 248 | "_prefab": null, 249 | "groupIndex": 0 250 | }, 251 | { 252 | "__type__": "cc.Sprite", 253 | "_name": "", 254 | "_objFlags": 0, 255 | "node": { 256 | "__id__": 6 257 | }, 258 | "_enabled": true, 259 | "_spriteFrame": { 260 | "__uuid__": "89fffe72-3788-43a7-bc5b-97dd8f1c0caa" 261 | }, 262 | "_type": 0, 263 | "_sizeMode": 1, 264 | "_fillType": 0, 265 | "_fillCenter": { 266 | "__type__": "cc.Vec2", 267 | "x": 0, 268 | "y": 0 269 | }, 270 | "_fillStart": 0, 271 | "_fillRange": 0, 272 | "_isTrimmedMode": true, 273 | "_srcBlendFactor": 770, 274 | "_dstBlendFactor": 771, 275 | "_atlas": null 276 | }, 277 | { 278 | "__type__": "f34ac2GGiVOBbG6XlfvgYP4", 279 | "_name": "", 280 | "_objFlags": 0, 281 | "node": { 282 | "__id__": 6 283 | }, 284 | "_enabled": true, 285 | "spriteFrameSet": [ 286 | { 287 | "__id__": 9 288 | }, 289 | { 290 | "__id__": 10 291 | } 292 | ] 293 | }, 294 | { 295 | "__type__": "SpriteFrameSet", 296 | "language": "en", 297 | "spriteFrame": { 298 | "__uuid__": "10db723c-667b-4727-99a2-7adff08d3fc5" 299 | } 300 | }, 301 | { 302 | "__type__": "SpriteFrameSet", 303 | "language": "zh", 304 | "spriteFrame": { 305 | "__uuid__": "89fffe72-3788-43a7-bc5b-97dd8f1c0caa" 306 | } 307 | }, 308 | { 309 | "__type__": "cc.Node", 310 | "_name": "dynamicLabel", 311 | "_objFlags": 0, 312 | "_opacity": 255, 313 | "_color": { 314 | "__type__": "cc.Color", 315 | "r": 255, 316 | "g": 255, 317 | "b": 255, 318 | "a": 255 319 | }, 320 | "_cascadeOpacityEnabled": true, 321 | "_parent": { 322 | "__id__": 2 323 | }, 324 | "_anchorPoint": { 325 | "__type__": "cc.Vec2", 326 | "x": 0.5, 327 | "y": 0.5 328 | }, 329 | "_contentSize": { 330 | "__type__": "cc.Size", 331 | "width": 97.87, 332 | "height": 40 333 | }, 334 | "_children": [], 335 | "_rotationX": 0, 336 | "_rotationY": 0, 337 | "_scaleX": 1, 338 | "_scaleY": 1, 339 | "_position": { 340 | "__type__": "cc.Vec2", 341 | "x": 0, 342 | "y": 143 343 | }, 344 | "_skewX": 0, 345 | "_skewY": 0, 346 | "_localZOrder": 0, 347 | "_globalZOrder": 0, 348 | "_tag": -1, 349 | "_opacityModifyRGB": false, 350 | "_id": "45025WV1CxPiLy/EnqG7Zg5", 351 | "_active": true, 352 | "_components": [ 353 | { 354 | "__id__": 12 355 | } 356 | ], 357 | "_prefab": null, 358 | "groupIndex": 0 359 | }, 360 | { 361 | "__type__": "cc.Label", 362 | "_name": "", 363 | "_objFlags": 0, 364 | "node": { 365 | "__id__": 11 366 | }, 367 | "_enabled": true, 368 | "_useOriginalSize": false, 369 | "_actualFontSize": 40, 370 | "_fontSize": 40, 371 | "_lineHeight": 40, 372 | "_enableWrapText": true, 373 | "_N$file": null, 374 | "_isSystemFontUsed": true, 375 | "_N$string": "Label", 376 | "_N$horizontalAlign": 1, 377 | "_N$verticalAlign": 1, 378 | "_N$overflow": 0 379 | }, 380 | { 381 | "__type__": "cc.Canvas", 382 | "_name": "", 383 | "_objFlags": 0, 384 | "node": { 385 | "__id__": 2 386 | }, 387 | "_enabled": true, 388 | "_designResolution": { 389 | "__type__": "cc.Size", 390 | "width": 960, 391 | "height": 640 392 | }, 393 | "_fitWidth": false, 394 | "_fitHeight": true 395 | }, 396 | { 397 | "__type__": "280c3rsZJJKnZ9RqbALVwtK", 398 | "_name": "", 399 | "_objFlags": 0, 400 | "node": { 401 | "__id__": 2 402 | }, 403 | "_enabled": true, 404 | "label": { 405 | "__id__": 12 406 | } 407 | } 408 | ] -------------------------------------------------------------------------------- /assets/testScene.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "1b1d7d36-5330-4bd5-b3f4-95a2982e1e2e", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs" 5 | }, 6 | "exclude": [ 7 | "node_modules", 8 | "library", 9 | "local", 10 | "settings", 11 | "temp" 12 | ] 13 | } -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos2d-html5", 3 | "packages": "packages" 4 | } -------------------------------------------------------------------------------- /settings/builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "appKey": "", 3 | "appSecret": "", 4 | "excludeScenes": [], 5 | "includeAnySDK": false, 6 | "includeSdk": [ 7 | "anysdk" 8 | ], 9 | "oauthLoginServer": "", 10 | "orientation": { 11 | "landscapeLeft": true, 12 | "landscapeRight": true, 13 | "portrait": false, 14 | "upsideDown": false 15 | }, 16 | "packageName": "org.cocos2d.helloworld", 17 | "privateKey": "", 18 | "renderMode": "0", 19 | "startScene": "1b1d7d36-5330-4bd5-b3f4-95a2982e1e2e", 20 | "title": "hello_world", 21 | "webOrientation": "auto", 22 | "inlineSpriteFrames": true, 23 | "mergeStartScene": false 24 | } -------------------------------------------------------------------------------- /settings/builder.panel.json: -------------------------------------------------------------------------------- 1 | { 2 | "excludeScenes": [], 3 | "packageName": "org.cocos2d.helloworld", 4 | "platform": "web-mobile", 5 | "startScene": "2d2f792f-a40c-49bb-a189-ed176a246e49", 6 | "title": "HelloWorld" 7 | } -------------------------------------------------------------------------------- /settings/i18n.json: -------------------------------------------------------------------------------- 1 | { 2 | "default_language": "zh", 3 | "languages": [ 4 | "zh", 5 | "en" 6 | ] 7 | } -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "collision-matrix": [ 3 | [ 4 | true 5 | ] 6 | ], 7 | "excluded-modules": [], 8 | "group-list": [ 9 | "default" 10 | ], 11 | "start-scene": "current" 12 | } -------------------------------------------------------------------------------- /template-banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nantas/demo-i18n/1907aea1afcb2a4be975f5cea0762569ee27b63c/template-banner.png -------------------------------------------------------------------------------- /template.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "TEMPLATES.helloworld.name", 3 | "desc": "TEMPLATES.helloworld.desc", 4 | "banner": "template-banner.png" 5 | } --------------------------------------------------------------------------------