PR #818: Adding support for string table lookups in dropdown field labels

Adding support for string table lookups in dropdown field labels specified in JSON.

Adds Blockly.utils.replaceMessageReferences() method to handle string replacement without interpolation tokens.  Effectively uses the same old code, now moved into tokenizeInterpolation_(), which takes a parseInterpolationTokens option.

Replaces the direct JavaScript references (not pure JSON, and thus not portable).

Demonstrating this behavior in the logic_boolean dropdown.
This commit is contained in:
Andrew n marshall
2017-01-11 15:47:56 -08:00
committed by GitHub
parent 35d83a576f
commit ac3df2759c
4 changed files with 75 additions and 6 deletions

View File

@@ -445,8 +445,8 @@ Blockly.Blocks['logic_boolean'] = {
"type": "field_dropdown",
"name": "BOOL",
"options": [
[Blockly.Msg.LOGIC_BOOLEAN_TRUE, "TRUE"],
[Blockly.Msg.LOGIC_BOOLEAN_FALSE, "FALSE"]
["%{bky_logic_boolean_true}", "TRUE"],
["%{bky_logic_boolean_false}", "FALSE"]
]
}
],