grunt-i18n-gspreadsheet
Advanced tools
Comparing version 0.1.2 to 0.1.3
{ | ||
"name": "grunt-i18n-gspreadsheet", | ||
"description": "Grunt plugin to generate i18n locale files from a google spreadsheet", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/theoephraim/grunt-i18n-gspreadsheet", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -41,4 +41,3 @@ # grunt-i18n-gspreadsheet | ||
#### options.google_account | ||
Type: `String` | ||
Default value: null | ||
Type: `String` (required if doc is private) | ||
@@ -48,4 +47,3 @@ The google account (email) to use for authentication. This account must have read access to the spreadsheet you want to pull the translations from. | ||
#### options.google_password | ||
Type: `String` | ||
Default value: null | ||
Type: `String` (required if doc is private) | ||
@@ -57,4 +55,3 @@ The password for the above google account. | ||
#### options.document_key | ||
Type: `String` | ||
Default value: null | ||
Type: `String` (required) | ||
@@ -65,4 +62,3 @@ The spreadsheet key. You can get this from the URL while viewing your spreadsheet | ||
#### options.key_column | ||
Type: `String` | ||
Default value: `'key'` | ||
Type: `String` -- Default: `'key'` | ||
@@ -76,4 +72,3 @@ The column header for the translation keys. | ||
#### options.default_locale | ||
Type: `String` | ||
Default value: `'en'` | ||
Type: `String` -- Default: `'en'` | ||
@@ -83,7 +78,13 @@ A string value to signify which locale is the default - useful in conjunction with the `write_default_translations` option (below). | ||
#### options.write_default_translations | ||
Type: `Boolean` | ||
Default value: `true` | ||
Type: `Boolean` -- Default: `true` | ||
Whether to write default translations or not. This is useful because most of the time, the default language translation is used as the translation key. But occasionally for some longer text items, you may wish to keep the key as key instead of text. This option lets you leave the default locale column (`en` by default) blank, but the translations will still end up in your `en.js` translation file. Most i18n plugins will default to use the translation key if no translation is found, but this may be useful in some cases. | ||
#### options.sort_keys | ||
Type: `Boolean` -- Default: `true` | ||
Enable/disable sorting of the translation keys before writing to the file. If false, translations will appear in the same order as they do in the spreadsheet. | ||
### Usage Examples | ||
@@ -90,0 +91,0 @@ |
@@ -27,3 +27,4 @@ /* | ||
default_locale: 'en', | ||
write_default_translations: true | ||
write_default_translations: true, | ||
sort_keys: true | ||
}); | ||
@@ -107,2 +108,3 @@ | ||
var file_path = output_dir + '/' + locale + '.js'; | ||
if ( options.sort_keys ) translations[locale] = sortObjectByKeys( translations[locale] ); | ||
var translation_json = JSON.stringify( translations[locale], null, ' ' ); | ||
@@ -128,1 +130,12 @@ var write_options = { | ||
}; | ||
function sortObjectByKeys(map) { | ||
var keys = _.sortBy(_.keys(map), function(a) { return a; }); | ||
var newmap = {}; | ||
_.each(keys, function(k) { | ||
newmap[k] = map[k]; | ||
}); | ||
return newmap; | ||
} | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14377
198
116