codecombat/app/schemas/i18n_schema.coffee

46 lines
1.2 KiB
CoffeeScript
Raw Normal View History

2014-04-12 04:35:56 -04:00
#this file will hold the experimental JSON schema for i18n
c = require './schemas'
languageCodeArrayRegex = c.generateLanguageCodeArrayRegex()
ExampleSchema = {
2014-06-30 22:16:26 -04:00
title: 'Example Schema',
description: 'An example schema',
type: 'object',
2014-04-12 04:35:56 -04:00
properties: {
text: {
2014-06-30 22:16:26 -04:00
title: 'Text',
description: 'A short message to display in the dialogue area. Markdown okay.',
type: 'string',
2014-04-12 04:35:56 -04:00
maxLength: 400
},
2014-06-30 22:16:26 -04:00
i18n: {'$ref': '#/definitions/i18n'}
2014-04-12 04:35:56 -04:00
},
definitions: {
i18n: {
2014-06-30 22:16:26 -04:00
title: 'i18n',
description: 'The internationalization object',
type: 'object',
2014-04-12 04:35:56 -04:00
patternProperties: {
languageCodeArrayRegex: {
additionalProperties: false,
properties: {
#put the translatable properties here
#if it is possible to not include i18n with a reference
# to #/properties, you could just do
2014-06-30 22:16:26 -04:00
properties: {'$ref': '#/properties'}
# text: {'$ref': '#/properties/text'}
2014-04-12 04:35:56 -04:00
}
default: {
2014-06-30 22:16:26 -04:00
title: 'LanguageCode',
description: 'LanguageDescription'
2014-04-12 04:35:56 -04:00
}
}
}
}
2014-06-30 22:16:26 -04:00
}
2014-04-12 04:35:56 -04:00
}
#define a i18n object type for each schema, then have the i18n have it's oneOf check against
2014-06-30 22:16:26 -04:00
#translatable schemas of that object