mirror of
https://github.com/google/blockly.git
synced 2026-01-26 02:00:10 +01:00
Merge branch 'master' of https://github.com/google/blockly.wiki
Conflicts: DropDown.md
@@ -9,7 +9,6 @@ Drop-down menus can be somewhat complicated field elements used in creating bloc
|
||||
var dropdown = new Blockly.FieldDropdown([['world', 'WORLD'], ['computer', 'CPU']]);
|
||||
input.appendField(dropdown, 'MODE');
|
||||
```
|
||||
|
||||

|
||||
|
||||
The ` FieldDropdown ` object is created with a list of menu options. Each option is made up of two strings. The first is the human-readable text to display. The second is a string constant which is used when saving the option to XML. This separation allows a dropdown menu's setting to be preserved between languages. For instance an English (` en/ `) version of a block may define ` [['left', 'LEFT'], ['right', 'RIGHT']] ` while a German (` de/ `) version of the same block would define ` [['links', 'LEFT'], ['rechts', 'RIGHT']] `.
|
||||
@@ -29,4 +28,4 @@ Another advantage of this approach is that word order often changes between lang
|
||||
|
||||
However, sometimes the prefix/suffix matching fails. There are some cases where two words should always go together and the prefix should not be factored out. For example ` 'drive red car' ` and ` 'drive red truck' ` should arguably only have ` 'drive' ` factored out, not ` 'drive red' `. The Unicode non-breaking space ` '\u00A0' ` may be used in place of a regular space to suppress the prefix/suffix matcher. Thus the above example can be fixed with ` 'drive red\u00A0car' ` and ` 'drive red\u00A0truck' `.
|
||||
|
||||
Another place where prefix/suffix matching fails is in languages that do not separate individual words with spaces. Chinese is a good example. The string
|
||||
Another place where prefix/suffix matching fails is in languages that do not separate individual words with spaces. Chinese is a good example. The string
|
||||
|
||||
Reference in New Issue
Block a user