makewitharduino / BlocklyDuino

BlocklyDuino is a web-based visual programming editor for arduino.
code.makewitharduino.com
7 stars 5 forks source link

Chinese Language issues #23

Open sinocgtchen opened 8 years ago

sinocgtchen commented 8 years ago

Hi,

I made a string language "zh-hant.js", but the string "zh-hant" can not be parsed correctly by init.js. I tracing the init.js code, it seems not doing "zh-hant" string in function setScript(). How to solve this problems? Thanks!

Dennis

okhiroyuki commented 8 years ago

Hi, I add zh-hant lang on setting dialog!

Please Pull Request

If possible , I want you to pull request the zh-hant.json. And then , you built-in to the official version.

.js vs .json

zh-hant.js is generated by zh-hant.json. Please edit zh-hant.json.

How to generate *.js file

run python build.py.

How to add a language file

1.Add msg-zh_hant params in header.js

var filepath = {
  media: '../../media/',
  msg_ja: "../../msg/js/ja.js",
  msg_en: "../../msg/js/en.js",
  msg_ja_kids: "../../msg/js/ja_kids.js",
  msg_zh_hant: "../../msg/js/zh-hant.js"
};

2.Add lang selector in base.html

<p id="dialog-lang-title">Language Setting</p>
                <table>
                    <tbody>
                        <tr>
                            <td>
                                <input class="with-gap" name="group1" type="radio" id="select-lang-en" value="en" />
                                <label for="select-lang-en" id="label-en">English</label>
                            </td>
                            <td>
                                <input class="with-gap" name="group1" type="radio" id="select-lang-ja" value="ja" />
                                <label for="select-lang-ja" id="label-ja">日本語</label>
                            </td>
                            <td>
                                <input class="with-gap" name="group1" type="radio" id="select-lang-ja_kids" value="ja_kids" />
                                <label for="select-lang-ja_kids" id="label-ja-kids">にほんご</label>
                            </td>
                            <td>
                                <input class="with-gap" name="group1" type="radio" id="select-lang-zh_hant" value="zh_hant" />
                                <label for="select-lang-zh_hant" id="label-zh_hant">Chinese</label>
                            </td>
                        </tr>
                    </tbody>
                </table>

3. generate index.html

run python joint.py