@@ -248,7 +248,7 @@ const FormBuilder = function(opts, element) {
248248 d . stage . classList . remove ( 'empty' )
249249 } else if ( ! opts . prepend && ! opts . append ) {
250250 d . stage . classList . add ( 'empty' )
251- d . stage . dataset . content = i18n . getStarted
251+ d . stage . dataset . content = mi18n . get ( ' getStarted' )
252252 }
253253
254254 if ( nonEditableFields ( ) ) {
@@ -267,8 +267,8 @@ const FormBuilder = function(opts, element) {
267267 const fieldOptions = function ( fieldData ) {
268268 const { type, values, name } = fieldData
269269 let fieldValues
270- const optionActions = [ m ( 'a' , i18n . addOption , { className : 'add add-opt' } ) ]
271- const fieldOptions = [ m ( 'label' , i18n . selectOptions , { className : 'false-label' } ) ]
270+ const optionActions = [ m ( 'a' , mi18n . get ( ' addOption' ) , { className : 'add add-opt' } ) ]
271+ const fieldOptions = [ m ( 'label' , mi18n . get ( ' selectOptions' ) , { className : 'false-label' } ) ]
272272 const isMultiple = fieldData . multiple || type === 'checkbox-group'
273273 const optionDataTemplate = label => {
274274 const optionData = {
@@ -288,7 +288,7 @@ const FormBuilder = function(opts, element) {
288288 if ( [ 'checkbox-group' , 'checkbox' ] . includes ( type ) ) {
289289 defaultOptCount = [ 1 ]
290290 }
291- fieldValues = defaultOptCount . map ( index => optionDataTemplate ( `${ i18n . option } ${ index } ` ) )
291+ fieldValues = defaultOptCount . map ( index => optionDataTemplate ( `${ mi18n . get ( 'optionCount' , index ) } ` ) )
292292
293293 const firstOption = fieldValues [ 0 ]
294294 if ( firstOption . hasOwnProperty ( 'selected' ) && type !== 'radio-group' ) {
@@ -374,10 +374,10 @@ const FormBuilder = function(opts, element) {
374374 const fieldAttrs = defaultFieldAttrs ( type )
375375 const advFieldMap = {
376376 required : ( ) => requiredField ( values ) ,
377- toggle : ( ) => boolAttribute ( 'toggle' , values , { first : i18n . toggle } ) ,
377+ toggle : ( ) => boolAttribute ( 'toggle' , values , { first : mi18n . get ( ' toggle' ) } ) ,
378378 inline : ( ) => {
379379 const labels = {
380- first : i18n . inline ,
380+ first : mi18n . get ( ' inline' ) ,
381381 second : mi18n . get ( 'inlineDesc' , type . replace ( '-group' , '' ) ) ,
382382 }
383383
@@ -417,23 +417,23 @@ const FormBuilder = function(opts, element) {
417417 }
418418 availableRoles . push ( '</div>' )
419419 const accessLabels = {
420- first : i18n . roles ,
421- second : i18n . limitRole ,
420+ first : mi18n . get ( ' roles' ) ,
421+ second : mi18n . get ( ' limitRole' ) ,
422422 content : availableRoles . join ( '' ) ,
423423 }
424424
425425 return boolAttribute ( 'access' , values , accessLabels )
426426 } ,
427427 other : ( ) =>
428428 boolAttribute ( 'other' , values , {
429- first : i18n . enableOther ,
430- second : i18n . enableOtherMsg ,
429+ first : mi18n . get ( ' enableOther' ) ,
430+ second : mi18n . get ( ' enableOtherMsg' ) ,
431431 } ) ,
432432 options : ( ) => fieldOptions ( values ) ,
433433 requireValidOption : ( ) =>
434434 boolAttribute ( 'requireValidOption' , values , {
435435 first : ' ' ,
436- second : i18n . requireValidOption ,
436+ second : mi18n . get ( ' requireValidOption' ) ,
437437 } ) ,
438438 multiple : ( ) => {
439439 const typeLabels = {
@@ -442,12 +442,12 @@ const FormBuilder = function(opts, element) {
442442 second : 'set multiple attribute' ,
443443 } ,
444444 file : {
445- first : i18n . multipleFiles ,
446- second : i18n . allowMultipleFiles ,
445+ first : mi18n . get ( ' multipleFiles' ) ,
446+ second : mi18n . get ( ' allowMultipleFiles' ) ,
447447 } ,
448448 select : {
449449 first : ' ' ,
450- second : i18n . selectionsMessage ,
450+ second : mi18n . get ( ' selectionsMessage' ) ,
451451 } ,
452452 }
453453 return boolAttribute ( 'multiple' , values , typeLabels [ type ] || typeLabels . default )
@@ -530,7 +530,7 @@ const FormBuilder = function(opts, element) {
530530 for ( const attribute in typeUserAttr ) {
531531 if ( typeUserAttr . hasOwnProperty ( attribute ) ) {
532532 const attrValType = userAttrType ( attribute , typeUserAttr [ attribute ] )
533- const orig = i18n [ attribute ]
533+ const orig = mi18n . get ( attribute )
534534 const tUA = typeUserAttr [ attribute ]
535535 const origValue = tUA . value || ''
536536 tUA . value = values [ attribute ] || tUA . value || ''
@@ -701,8 +701,8 @@ const FormBuilder = function(opts, element) {
701701 const numberAttribute = ( attribute , values ) => {
702702 const { class : classname , className, ...attrs } = values
703703 const attrVal = attrs [ attribute ]
704- const attrLabel = i18n [ attribute ] || attribute
705- const placeholder = i18n [ `placeholder.${ attribute } ` ]
704+ const attrLabel = mi18n . get ( attribute ) || attribute
705+ const placeholder = mi18n . get ( `placeholder.${ attribute } ` )
706706 const inputConfig = {
707707 type : 'number' ,
708708 value : attrVal ,
@@ -748,7 +748,7 @@ const FormBuilder = function(opts, element) {
748748 name : attribute ,
749749 className : `fld-${ attribute } form-control` ,
750750 }
751- const labelText = i18n [ attribute ] || capitalize ( attribute ) || ''
751+ const labelText = mi18n . get ( attribute ) || capitalize ( attribute ) || ''
752752 const label = m ( 'label' , labelText , { for : selectAttrs . id } )
753753 const select = m ( 'select' , selectOptions , selectAttrs )
754754 const inputWrap = m ( 'div' , select , { className : 'input-wrap' } )
@@ -770,17 +770,17 @@ const FormBuilder = function(opts, element) {
770770 const textArea = [ 'paragraph' ]
771771
772772 let attrVal = values [ attribute ] || ''
773- let attrLabel = i18n [ attribute ]
773+ let attrLabel = mi18n . get ( attribute )
774774
775775 if ( attribute === 'label' ) {
776776 if ( textArea . includes ( values . type ) ) {
777- attrLabel = i18n . content
777+ attrLabel = mi18n . get ( ' content' )
778778 } else {
779779 attrVal = parsedHtml ( attrVal )
780780 }
781781 }
782782
783- const placeholder = i18n [ `placeholders.${ attribute } ` ] || ''
783+ const placeholder = mi18n . get ( `placeholders.${ attribute } ` ) || ''
784784 let attributefield = ''
785785 const noMakeAttr = [ ]
786786
@@ -831,7 +831,7 @@ const FormBuilder = function(opts, element) {
831831 }
832832 if ( ! noMake . some ( elem => elem === true ) ) {
833833 requireField = boolAttribute ( 'required' , fieldData , {
834- first : i18n . required ,
834+ first : mi18n . get ( ' required' ) ,
835835 } )
836836 }
837837
@@ -841,26 +841,26 @@ const FormBuilder = function(opts, element) {
841841 // Append the new field to the editor
842842 const appendNewField = function ( values , isNew = true ) {
843843 const type = values . type || 'text'
844- const label = values . label || ( isNew ? i18n [ type ] || i18n . label : '' )
844+ const label = values . label || ( isNew ? i18n . get ( type ) || mi18n . get ( ' label' ) : '' )
845845 const disabledFieldButtons = opts . disabledFieldButtons [ type ] || values . disabledFieldButtons
846846 let fieldButtons = [
847847 m ( 'a' , null , {
848848 type : 'remove' ,
849849 id : 'del_' + data . lastID ,
850850 className : 'del-button btn icon-cancel delete-confirm' ,
851- title : i18n . removeMessage ,
851+ title : mi18n . get ( ' removeMessage' ) ,
852852 } ) ,
853853 m ( 'a' , null , {
854854 type : 'edit' ,
855855 id : data . lastID + '-edit' ,
856856 className : 'toggle-form btn icon-pencil' ,
857- title : i18n . hide ,
857+ title : mi18n . get ( ' hide' ) ,
858858 } ) ,
859859 m ( 'a' , null , {
860860 type : 'copy' ,
861861 id : data . lastID + '-copy' ,
862862 className : 'copy-button btn icon-copy' ,
863- title : i18n . copyButtonTooltip ,
863+ title : mi18n . get ( ' copyButtonTooltip' ) ,
864864 } ) ,
865865 ]
866866
@@ -892,7 +892,7 @@ const FormBuilder = function(opts, element) {
892892 liContents . push ( m ( 'span' , '?' , descAttrs ) )
893893
894894 liContents . push ( m ( 'div' , '' , { className : 'prev-holder' } ) )
895- const formElements = m ( 'div' , [ advFields ( values ) , m ( 'a' , i18n . close , { className : 'close-field' } ) ] , {
895+ const formElements = m ( 'div' , [ advFields ( values ) , m ( 'a' , mi18n . get ( ' close' ) , { className : 'close-field' } ) ] , {
896896 className : 'form-elements' ,
897897 } )
898898
@@ -966,7 +966,7 @@ const FormBuilder = function(opts, element) {
966966 name : name + '-option' ,
967967 }
968968
969- attrs . placeholder = i18n [ `placeholder.${ prop } ` ] || ''
969+ attrs . placeholder = mi18n . get ( `placeholder.${ prop } ` ) || ''
970970
971971 if ( prop === 'selected' && optionData . selected === true ) {
972972 attrs . checked = optionData . selected
@@ -978,7 +978,7 @@ const FormBuilder = function(opts, element) {
978978
979979 const removeAttrs = {
980980 className : 'remove btn icon-cancel' ,
981- title : i18n . removeMessage ,
981+ title : mi18n . get ( ' removeMessage' ) ,
982982 }
983983 optionInputs . push ( m ( 'a' , null , removeAttrs ) )
984984
@@ -1046,7 +1046,7 @@ const FormBuilder = function(opts, element) {
10461046 const options = field . querySelector ( '.sortable-options' )
10471047 const optionsCount = options . childNodes . length
10481048 if ( optionsCount <= 2 && ! type . includes ( 'checkbox' ) ) {
1049- opts . notify . error ( 'Error: ' + i18n . minOptionMessage )
1049+ opts . notify . error ( 'Error: ' + mi18n . get ( ' minOptionMessage' ) )
10501050 } else {
10511051 $option . slideUp ( '250' , ( ) => {
10521052 $option . remove ( )
@@ -1191,7 +1191,7 @@ const FormBuilder = function(opts, element) {
11911191 if ( e . target . value === '' ) {
11921192 $ ( e . target )
11931193 . addClass ( 'field-error' )
1194- . attr ( 'placeholder' , i18n . cannotBeEmpty )
1194+ . attr ( 'placeholder' , mi18n . get ( ' cannotBeEmpty' ) )
11951195 } else {
11961196 $ ( e . target ) . removeClass ( 'field-error' )
11971197 }
@@ -1239,8 +1239,8 @@ const FormBuilder = function(opts, element) {
12391239
12401240 // Check if user is sure they want to remove the field
12411241 if ( opts . fieldRemoveWarn ) {
1242- const warnH3 = m ( 'h3' , i18n . warning )
1243- const warnMessage = m ( 'p' , i18n . fieldRemoveWarning )
1242+ const warnH3 = m ( 'h3' , mi18n . get ( ' warning' ) )
1243+ const warnMessage = m ( 'p' , mi18n . get ( ' fieldRemoveWarning' ) )
12441244 h . confirm ( [ warnH3 , warnMessage ] , ( ) => h . removeField ( deleteID ) , coords )
12451245 $field . addClass ( 'deleting' )
12461246 } else {
0 commit comments