This commit is contained in:
Kate Hudson 2014-03-20 19:22:58 -04:00
Родитель bd2db5770b
Коммит 71aa25d2f1
5 изменённых файлов: 47359 добавлений и 45 удалений

Просмотреть файл

@ -2,11 +2,12 @@ module.exports = function(grunt) {
var path = require('path');
var STRINGS_FOLDER = 'strings/';
var BASE_FILENAME = 'latest/weblitmap.json';
var STRINGS_FOLDER = 'latest/strings/';
var FUNCTION_NAME = 'WebLiteracyClient';
var DEFAULT_LANG = 'en';
grunt.initConfig({
clean: ['latest/strings', 'dist'],
convert: {
strings: {
src: 'latest/weblitmap.json',
@ -18,28 +19,41 @@ module.exports = function(grunt) {
banner: grunt.file.read('./src/umd.header.js'),
footer: grunt.file.read('./src/umd.footer.js'),
process: function(src, filepath) {
console.log(filepath);
if (filepath.match('weblitmap.json')) {
var json = JSON.parse(src);
// Format the template
if (filepath.match(BASE_FILENAME)) {
var json = JSON.parse(src);
return FUNCTION_NAME + '.prototype.template = ' + JSON.stringify(json.literacies, null, ' ') + ';';
// Format each locale file
} else if (filepath.match(STRINGS_FOLDER)) {
var lang = path.basename(filepath, '.json');
var lang = filepath.replace(STRINGS_FOLDER, '').split('/')[0];
return FUNCTION_NAME + '.prototype.langs["'+ lang +'"] = ' + src + ';';
// Return as is
} else {
return src;
}
}
},
dist: {
src: ['src/web-literacy-client.js', 'latest/**/*.json'],
src: ['src/web-literacy-client.js', BASE_FILENAME, STRINGS_FOLDER + '**/*.json'],
dest: 'dist/web-literacy-client.with-langs.js',
}
}
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('transifex', 'Download files from transifex', function() {
var download = require('webmaker-download-locales');
var done = this.async();
download('webmaker', 'latest/strings', function(err, data) {
done();
});
});
grunt.registerMultiTask('convert', 'Convert map to locale files', function() {
function specToTransifex(json) {
@ -81,7 +95,7 @@ module.exports = function(grunt) {
var archiveDir = 'archive/' + json.version + '/';
// Write transifex file
var transifexFileName = STRINGS_FOLDER + DEFAULT_LANG + '.json';
var transifexFileName = 'weblitmap_strings.json';
grunt.file.write(file.dest + transifexFileName, JSON.stringify(transifex, null, ' '));
grunt.log.writeln('File "' + file.dest + transifexFileName + '" created.');
@ -101,6 +115,7 @@ module.exports = function(grunt) {
});
grunt.registerTask('build', ['convert', 'concat']);
grunt.registerTask('build', ['clean', 'convert', 'transifex', 'concat']);
grunt.registerTask('download', ['clean', 'transifex']);
};

Просмотреть файл

47330
dist/web-literacy-client.with-langs.js поставляемый

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,35 @@
{
"WBLIT-MAP": "Web Literacy Map",
"weblit-Navigation": "Navigation",
"weblit-Navigation_desc": "Using software tools to browse the Web",
"weblit-WebMechanics": "Web Mechanics",
"weblit-WebMechanics_desc": "Understanding the Web ecosystem",
"weblit-Search": "Search",
"weblit-Search_desc": "Locating information, people and resources via the Web",
"weblit-Credibility": "Credibility",
"weblit-Credibility_desc": "Critically evaluating information found on the Web",
"weblit-Security": "Security",
"weblit-Security_desc": "Keeping systems, identities, and content safe",
"weblit-Composing": "Composing for the Web",
"weblit-Composing_desc": "Creating and curating content for the Web",
"weblit-Remix": "Remixing",
"weblit-Remix_desc": "Modifying existing Web resources to create something new",
"weblit-DesignAccessibility": "Design and Accessibility",
"weblit-DesignAccessibility_desc": "Creating universally effective communications through Web resources",
"weblitCodingScripting": "Coding/Scripting",
"weblitCodingScripting_desc": "Creating interactive experiences on the Web",
"weblit-Infrastructure": "Infrastructure",
"weblit-Infrastructure_desc": "Understanding the Internet stack",
"weblit-Sharing": "Sharing",
"weblit-Sharing_desc": "Providing access to Web resources",
"weblit-SharingCollaborating": "Sharing",
"weblit-SharingCollaborating_desc": "Providing access to Web resources",
"weblit-Collaborating": "Collaborating",
"weblit-Collaborating_desc": "Creating Web resources with others",
"weblit-Community": "Community Participation",
"weblit-Community_desc": "Getting involved in web communities and understanding their practices",
"weblit-Privacy": "Privacy",
"weblit-Privacy_desc": "Examining the consequences of sharing data online",
"weblit-OpenPractices": "Open Practices",
"weblit-OpenPractices_desc": "Helping to keep the Web democratic and universally accessible"
}

Просмотреть файл

@ -18,6 +18,10 @@
"homepage": "https://github.com/k88hudson/weblit-keys",
"devDependencies": {
"grunt": "~0.4.4",
"grunt-contrib-concat": "~0.3.0"
"grunt-contrib-concat": "~0.3.0",
"install": "~0.1.7",
"npm": "~1.4.6",
"webmaker-download-locales": "~0.1.1",
"grunt-contrib-clean": "~0.5.0"
}
}