@@ -16,49 +16,49 @@ goog.require('Blockly.Type');
1616/** Single character. */
1717Blockly . Types . CHARACTER = new Blockly . Type ( {
1818 typeId : 'Character' ,
19- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_CHAR ; } ,
19+ typeNameMsgId : ' ARD_TYPE_CHAR' ,
2020 compatibleTypes : [ ]
2121} ) ;
2222
2323/** Text string. */
2424Blockly . Types . TEXT = new Blockly . Type ( {
2525 typeId : 'Text' ,
26- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_TEXT ; } ,
26+ typeNameMsgId : ' ARD_TYPE_TEXT' ,
2727 compatibleTypes : [ Blockly . Types . CHARACTER ]
2828} ) ;
2929
3030/** Boolean. */
3131Blockly . Types . BOOLEAN = new Blockly . Type ( {
3232 typeId : 'Boolean' ,
33- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_BOOL ; } ,
33+ typeNameMsgId : ' ARD_TYPE_BOOL' ,
3434 compatibleTypes : [ ]
3535} ) ;
3636
3737/** Short integer number. */
3838Blockly . Types . SHORT_NUMBER = new Blockly . Type ( {
3939 typeId : 'Short Positive Number' ,
40- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_SHORTPOS ; } ,
40+ typeNameMsgId : ' ARD_TYPE_SHORTPOS' ,
4141 compatibleTypes : [ ] // Circular dependencies, add after all declarations
4242} ) ;
4343
4444/** Integer number. */
4545Blockly . Types . NUMBER = new Blockly . Type ( {
4646 typeId : 'Number' ,
47- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_NUMBER ; } ,
47+ typeNameMsgId : ' ARD_TYPE_NUMBER' ,
4848 compatibleTypes : [ ] // Circular dependencies, add after all declarations
4949} ) ;
5050
5151/** Large integer number. */
5252Blockly . Types . LARGE_NUMBER = new Blockly . Type ( {
5353 typeId : 'Large Number' ,
54- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_LONG ; } ,
54+ typeNameMsgId : ' ARD_TYPE_LONG' ,
5555 compatibleTypes : [ ] // Circular dependencies, add after all declarations
5656} ) ;
5757
5858/** Decimal/floating point number. */
5959Blockly . Types . DECIMAL = new Blockly . Type ( {
6060 typeId : 'Decimal' ,
61- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_DECIMAL ; } ,
61+ typeNameMsgId : ' ARD_TYPE_DECIMAL' ,
6262 compatibleTypes : [ Blockly . Types . BOOLEAN ,
6363 Blockly . Types . SHORT_NUMBER ,
6464 Blockly . Types . NUMBER ,
@@ -68,28 +68,28 @@ Blockly.Types.DECIMAL = new Blockly.Type({
6868/** Array/List of items. */
6969Blockly . Types . ARRAY = new Blockly . Type ( {
7070 typeId : 'Array' ,
71- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_ARRAY } ,
71+ typeNameMsgId : ' ARD_TYPE_ARRAY' ,
7272 compatibleTypes : [ ]
7373} ) ;
7474
7575/** Null indicate there is no type. */
7676Blockly . Types . NULL = new Blockly . Type ( {
7777 typeId : 'Null' ,
78- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_NULL ; } ,
78+ typeNameMsgId : ' ARD_TYPE_NULL' ,
7979 compatibleTypes : [ ]
8080} ) ;
8181
8282/** Type not defined, or not yet defined. */
8383Blockly . Types . UNDEF = new Blockly . Type ( {
8484 typeId : 'Undefined' ,
85- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_UNDEF ; } ,
85+ typeNameMsgId : ' ARD_TYPE_UNDEF' ,
8686 compatibleTypes : [ ]
8787} ) ;
8888
8989/** Set when no child block (meant to define the variable type) is connected. */
9090Blockly . Types . CHILD_BLOCK_MISSING = new Blockly . Type ( {
9191 typeId : 'ChildBlockMissing' ,
92- typeName : function ( ) { return Blockly . Msg . ARD_TYPE_CHILDBLOCKMISSING ; } ,
92+ typeNameMsgId : ' ARD_TYPE_CHILDBLOCKMISSING' ,
9393 compatibleTypes : [ ]
9494} ) ;
9595
@@ -119,19 +119,20 @@ Blockly.Types.LARGE_NUMBER.addCompatibleTypes([
119119/**
120120 * Adds another type to the Blockly.Types collection.
121121 * @param {string } typeId_ Identifiable name of the type.
122- * @param {string } typeName_ Descriptive name of the type for use in the UI.
122+ * @param {string } typeNameMsgId_ Name of the member variable from Blockly.Msg
123+ * object to identify the translateble string.for the Type name.
123124 * @param {Array<Blockly.Type> } compatibleTypes_ List of types this Type is
124125 * compatible with.
125126 */
126- Blockly . Types . addType = function ( typeId_ , typeName_ , compatibleTypes_ ) {
127+ Blockly . Types . addType = function ( typeId_ , typeNameMsgId_ , compatibleTypes_ ) {
127128 // The Id is used as the key from the value pair in the BlocklyTypes object
128129 var key = typeId_ . toUpperCase ( ) . replace ( / / g, '_' ) ;
129130 if ( Blockly . Types [ key ] !== undefined ) {
130131 throw 'The Blockly type ' + key + ' already exists.' ;
131132 }
132133 Blockly . Types [ key ] = new Blockly . Type ( {
133134 typeId : typeId_ ,
134- typeName : function ( ) { return typeName_ ; } ,
135+ typeName : typeNameMsgId_ ,
135136 compatibleTypes : compatibleTypes_
136137 } ) ;
137138} ;
@@ -148,7 +149,7 @@ Blockly.Types.getValidTypeArray = function() {
148149 ( typeKey !== 'NULL' ) && ( typeKey !== 'ARRAY' ) &&
149150 ( typeof Blockly . Types [ typeKey ] !== 'function' ) &&
150151 ! ( Blockly . Types [ typeKey ] instanceof RegExp ) ) {
151- typesArray . push ( [ Blockly . Types [ typeKey ] . typeName ( ) , typeKey ] ) ;
152+ typesArray . push ( [ Blockly . Types [ typeKey ] . typeName , typeKey ] ) ;
152153 }
153154 }
154155 return typesArray ;
0 commit comments