GithubHelp home page GithubHelp logo

isabella232 / grunt-magento-translation-to-json Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aoepeople/grunt-magento-translation-to-json

0.0 0.0 0.0 8 KB

Parses magento translation csv files and builds json for required keys (including fallback if no translation file available).

License: MIT License

JavaScript 100.00%

grunt-magento-translation-to-json's Introduction

Description

Parses magento translation files and extracts the given keys to a json map.

Example

de_DE/translation.csv contains:

"New","Neu"

en_US/translation.csv contains:

"New","New"

If configured to use the 'New' label, the output would be:

{
  "de-DE": {
    "New": "Neu"
  },
  "en-US": {
    "New": "New"
  }
}

Installation

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.

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.

Example

prepareTranslations: {
    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'
    }
}

Development

If you want to contribute, just clone the repository and run npm install. Tests and mocks reside in spec directory.

Test

npm test

No warranty

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.

grunt-magento-translation-to-json's People

Contributors

mdix avatar tomraithel avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.