import SimpleSchema from 'simpl-schema';

/*

Look for type name in a few different places
Note: look into simplifying this

*/
export const isIntlField = fieldSchema => {
  const typeProperty = fieldSchema.type;
  let type;
  if (Array.isArray(typeProperty)) {
    type = typeProperty[0].type;
  } else {
    type = typeProperty.singleType ? typeProperty.singleType : typeProperty.definitions[0].type;
  }
  return type.name === 'IntlString';
}

/*

Generate custom IntlString SimpleSchema type
TODO: WIP (languages hardcoded)

*/
const schema = {};

['en', 'ja'].forEach(locale => {
  schema[locale] = {
    type: String,
    optional: true,
  };
});

export const IntlString = new SimpleSchema(schema);
IntlString.name = 'IntlString';

@@ -33,16 +33,53 @@
 schema';
+%0Aimport %7B Strings %7D from './strings';
 %0A%0A/*%0A%0ALo
@@ -530,76 +530,96 @@
 ype%0A
-TODO: WIP (languages hardcoded)%0A%0A*/%0Aconst schema = %7B%7D;%0A%0A%5B'en', 'ja'%5D
+%0A*/%0Aexport const getIntlString = () =%3E %7B%0A  %0A  const schema = %7B%7D;%0A%0A  Object.keys(Strings)
 .for
@@ -635,16 +635,18 @@
 le =%3E %7B%0A
+  
   schema
@@ -658,16 +658,18 @@
 le%5D = %7B%0A
+  
     type
@@ -682,16 +682,18 @@
 ng,%0A    
+  
 optional
@@ -704,24 +704,23 @@
 ue,%0A
+  
   %7D;%0A
+  
 %7D);%0A%0A
-export
+ 
  con
@@ -761,16 +761,18 @@
 chema);%0A
+  
 IntlStri
@@ -779,24 +779,47 @@
 ng.name = 'IntlString';%0A
+  return IntlString;%0A%7D%0A

Use function to get IntlString type