Name: grunt-magento-translation-to-json
Owner: AOE
Description: Parses magento translation csv files and builds json for required keys (including fallback if no translation file available).
Created: 2015-06-30 09:41:54.0
Updated: 2016-03-22 18:39:47.0
Pushed: 2016-03-22 18:41:01.0
Homepage: null
Size: 8
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Parses magento translation files and extracts the given keys to a json map.
de_DE/translation.csv contains:
","Neu"
en_US/translation.csv contains:
","New"
If configured to use the 'New' label, the output would be:
e-DE": {
"New": "Neu"
n-US": {
"New": "New"
npm install grunt-magento-translation-to-json
Then load it in your gruntfile like:
require('grunt-magento-translation-to-json')(grunt);
Then proceed with the configuration.
The value of the file
property is the path to the translation file(s). The language code is replaced with a placeholder,
the task then loops over the languages and replaces the placeholder with the current language. Add the keys you need to
extract from the translation files to translationKeys
. The dest
property stores the destination path and filename.
areTranslations: {
files: {
file: '../../../Magento/app/locale/__languages__/Mage_Sales.csv',
languages: [
'de_DE',
'zh_Hans_CN',
'en_US'
],
translationKeys: [
'New'
],
dest: './js/modules/featurizer/gruntGeneratedTranslations.json'
}
If you want to contribute, just clone the repository and run npm install
. Tests and mocks reside in spec
directory.
npm test
The program is provided on an “as is” basis, without warranties or conditions of any kind, either express or implied including, without limitation, any warranties or conditions of title, non-infringement, merchantability or fitness for a particular purpose. Each recipient is solely responsible for determining the appropriateness of using and distributing the program and assumes all risks associated with its exercise of rights under this agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations.