GithubHelp home page GithubHelp logo

txhong / spree_i18n Goto Github PK

View Code? Open in Web Editor NEW

This project forked from spree-contrib/spree_i18n

0.0 2.0 0.0 5.51 MB

I18n translation files for the Spree project

Home Page: http://spreecommerce.com

License: BSD 3-Clause "New" or "Revised" License

Ruby 91.34% JavaScript 0.22% CoffeeScript 6.54% CSS 1.90%

spree_i18n's Introduction

Spree Internationalization

This is the Internationalization project for Spree Commerce

See the official Internationalization documentation for more details.

Happy translating!

Installation

Add the following to your Gemfile.

gem 'spree_i18n', github: 'spree/spree_i18n'

Run bundle install

You can use the generator to install migrations and append spree_i18n assets to your app spree manifest file.

rails g spree_i18n:install

This will insert this lines on your spree manifest files:

app/assets/javascripts/admin/all.js
//= require admin/spree_i18n

app/assets/javascripts/store/all.js
//= require store/spree_i18n

app/assets/stylesheets/admin/all.css
*= require admin/spree_i18n

Model Translations

We've added support for translating models. The feature uses the globalize3 gem to localize model data. So far the following models are translatable:

Product, Promotion, OptionType, Taxonomy, Taxon and Property.

Start you server and you should see a TRANSLATIONS link or a flag icon on each admin section that supports this feature.

The extension contains two configs that allow users to customize which locales should be displayed as options on the translation forms and which should be listed to customers on the frontend. You can set them on an initializer. e.g.

SpreeI18n::Config.available_locales = [:en, :es, :'pt-BR'] # displayed on translation forms
SpreeI18n::Config.supported_locales = [:en, :'pt-BR'] # displayed on frontend select box

ps. please use symbols, not strings. e.g. :'pt-BR' not just 'pt-BR'. Otherwise you may get unexpected errors

Or if you prefer they're also available on the admin UI general settings section.

Every record needs to have a translation. If by any chance you remove spree_i18n from your Gemfile, add some records and then add spree_i18n gem back you might get errors like undefined method for nilClass because Globalize will try fetch translations that do not exist.

Running the tests

If you would like to run the tests of this project, follow these steps:

  1. Clone this repo using git clone git://github.com/spree/spree_i18n
  2. Change into the directory and run bundle exec rake test_app to generate a dummy application.
  3. Run bundle exec rspec spec to run the tests.

Copyright (c) 2013 Spree Commerce Inc. and other contributors. released under the New BSD License

spree_i18n's People

Contributors

adhlssu07 avatar andreiglingeanu avatar camelmasa avatar futhr avatar geekoncoffee avatar greendog avatar groe avatar gugod avatar huoxito avatar igmarin avatar j15e avatar jdutil avatar jpavello avatar kagetsuki avatar kuroda avatar maxim-filimonov avatar per-gron avatar peterberkenbosch avatar pusewicz avatar radar avatar reinaris avatar robokaso avatar romul avatar sadfuzzy avatar schof avatar stadia avatar tka avatar tobiashm avatar tvdeyen avatar vyper avatar

Watchers

 avatar  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.