diff --git a/app.js b/app.js index 9b7760d..5758b2f 100644 --- a/app.js +++ b/app.js @@ -1,5 +1,5 @@ -process.env.NODE_ENV = "mamp"; +process.env.NODE_ENV = "development"; var express = require('express'); var path = require('path'); diff --git a/eanaEltuMigration/dictionary.js b/eanaEltuMigration/dictionary.js index 165bce3..004e8c1 100644 --- a/eanaEltuMigration/dictionary.js +++ b/eanaEltuMigration/dictionary.js @@ -153,7 +153,7 @@ Dictionary.prototype.exportLanguages = function (){ } return models.Language.bulkCreate(languages).then(function() { - models.Language.findAll().then(function (languages) { + return models.Language.findAll().then(function (languages) { languages.forEach(function (language) { self.languages[language.isoCode] = language; }); @@ -174,7 +174,7 @@ Dictionary.prototype.exportSources = function(){ } return models.Source.bulkCreate(sources).then(function() { - models.Source.findAll().then(function (sources) { + return models.Source.findAll().then(function (sources) { sources.forEach(function (source) { self.sources[source.name] = source; }); @@ -188,22 +188,28 @@ Dictionary.prototype.exportDictionaryTemplates = function () { var templates = [ { id: "localized_end", - latex: "__END__" + latex: "__END__", + html: "" }, { id: "newpage", - latex: "\\newpage" + latex: "\\newpage", + html: "" }, { id: "end_hangparas_multicols", - latex: "\\end{hangparas}}\\end{multicols}" + latex: "\\end{hangparas}}\\end{multicols}", + html: "" }, { id: "end_hangparas", - latex: "\\end{hangparas}" + latex: "\\end{hangparas}", + html: "" }, { id: "end_document", - latex: "\\end{document}" + latex: "\\end{document}", + html: "" }, { id: "end_hangparas_multicols_newpage", - latex: "\\end{hangparas}}\\end{multicols}+\\newpage" + latex: "\\end{hangparas}}\\end{multicols}+\\newpage", + html: "" }]; for(var id in self.eanaEltu.dictLayout){ @@ -216,7 +222,8 @@ Dictionary.prototype.exportDictionaryTemplates = function () { } templates.push({ id: layout.id.toLowerCase(), - latex: layout.value + latex: layout.value, + html: "" }); } @@ -457,6 +464,9 @@ Dictionary.prototype.exportEntryLayouts = function () { metadata: template.metadata }); } else { + if(template.format === undefined || template.format === null){ + template.format = "<< BLANK >>"; + } localizedLayouts.push({ EntryTypeId: templateId, LanguageIsoCode: lang, @@ -602,7 +612,7 @@ Dictionary.prototype.export = function (callback) { var secondLayerPromises = []; secondLayerPromises.push(self.exportDictionaryBuilds()); secondLayerPromises.push(self.exportMetadata()); - secondLayerPromises.push(self.exportPartsOfSpeech()); + //secondLayerPromises.push(self.exportPartsOfSpeech()); Promise.all(secondLayerPromises).then(function(){ @@ -781,7 +791,7 @@ function buildDictionaryMetadata(self) { }; var localization = self.eanaEltu.dictLoc[index]; for(var lc in localization){ - if(localization[lc].value === ''){ + if(localization[lc].value === '' || localization[lc].value === null || localization[lc].value === undefined){ if(self.debug){ console.log("Missing " + lc + " translation for [" + index + "]"); } @@ -789,12 +799,13 @@ function buildDictionaryMetadata(self) { self.missingMetadataTranslations[lc.toLowerCase()] = []; } self.missingMetadataTranslations[lc.toLowerCase()].push(index); - } else { - self.metadata[index][lc.toLowerCase()] = { - value: localization[lc].value, - editTime: localization[lc].editTime - }; + localization[lc] = {value: "<< NEEDS TRANSLATED >>"}; } + + self.metadata[index][lc.toLowerCase()] = { + value: localization[lc].value, + editTime: localization[lc].editTime + }; } } } @@ -1085,7 +1096,7 @@ function buildDictionaryTemplates(self) { localizedFormat = localizedFormat.replace(result[0], metadata); - meta[lc].value = metadata === "" ? undefined : metadata; + meta[lc].value = metadata === "" ? "<< NEEDS TRANSLATED >>" : metadata; } diff --git a/models/dictionaryTemplate.js b/models/dictionaryTemplate.js index fa12052..301b5cb 100644 --- a/models/dictionaryTemplate.js +++ b/models/dictionaryTemplate.js @@ -2,8 +2,8 @@ module.exports = function (sequelize, DataTypes) { var DictionaryTemplate = sequelize.define('DictionaryTemplate', { id: { type: DataTypes.STRING, primaryKey: true }, - latex: { type: DataTypes.TEXT, allowNull: false, defaultValue: "" }, - html: { type: DataTypes.TEXT, allowNull: false, defaultValue: "" }, + latex: { type: DataTypes.TEXT, allowNull: false }, + html: { type: DataTypes.TEXT, allowNull: false }, placeholders: { type: DataTypes.INTEGER, allowNull: false, defaultValue: 0 } }); diff --git a/models/localizedMetadata.js b/models/localizedMetadata.js index 65d5ede..c751d46 100644 --- a/models/localizedMetadata.js +++ b/models/localizedMetadata.js @@ -1,7 +1,7 @@ 'use strict'; module.exports = function (sequelize, DataTypes) { var LocalizedMetadata = sequelize.define('LocalizedMetadata', { - value: { type: DataTypes.STRING, allowNull: false } + value: { type: DataTypes.TEXT, allowNull: false } }); LocalizedMetadata.removeAttribute('id'); diff --git a/models/localizedentry.js b/models/localizedentry.js index 4c63ff3..3e17165 100644 --- a/models/localizedentry.js +++ b/models/localizedentry.js @@ -5,7 +5,7 @@ var models = require('./index'); module.exports = function (sequelize, DataTypes) { var LocalizedEntry = sequelize.define('LocalizedEntry', { - odd: DataTypes.STRING + odd: DataTypes.TEXT }); LocalizedEntry.removeAttribute('id'); diff --git a/vault.js b/vault.js index 393970b..7309096 100644 Binary files a/vault.js and b/vault.js differ