Git Product home page Git Product logo

spree_multi_lingual's Introduction

SpreeMultiLingual Build Status

SpreeMultiLingual is originally a proof of concept for what could become a multi-lingual Spree plugin.

Since then integration tests and features have been added.

Requirements

  • Spree 1.1.X
  • Rails 3.2.X

Installation

Add gem to your Gemfile:

gem "spree_multi_lingual", :git => "[email protected]:jipiboily/spree_multi_lingual.git"

Run Bundler

bundle install

Add an initializer file and set SpreeMultiLingual.languages to an array containing the languages you support.

# config/initializers/spree_multi_lingual.rb
SpreeMultiLingual.languages = ["fr", "en", "es"] # Add your own locales here

For the moment, enable locale fallbacks for I18n (makes lookups for any locale fall back to the I18n.default_locale when a translation can not be found)

# config/application.rb
config.I18n.fallbacks = true

Run spree_multi_lingual install:

rails g spree_multi_lingual:install

If you want to use browser language detection using rack-contrib Locale :

# config.ru
require 'rack'
require 'rack/contrib'

use Rack::Locale

require ::File.expand_path('../config/environment',  __FILE__)
run MyRailsApp::Application

Use

On views where there is translated fields, there should be a dropdown to switch currently edited locale.

Products: http://dl.dropbox.com/u/6210261/spree_multi_lingual.swf

Taxons: /!\ Using the taxonomy tree you can only edit another locale taxons name, to do so click on the links next to "Edit Taxonomy" to show the taxonomy for a given locale. If you want to create taxons using the taxonomy tree, please only use the default locale for the moment.

To edit taxons permalink please do as following: Taxon TaxonEdit

What is translated?

For now :

  • products : name, permalink, description, meta description and meta keywords.
  • taxonomies : name.
  • taxons : name, permalink and description.

WARNING

there is no fallback of default language for now unless you speficy I18n.fallbacks as previously stated.

Notes

It uses Globalize3, easy_globalize3_accessors and routing-filter. Thanks to Tomash that told me about those two awesome gems: easy_globalize3_accessors and routing-filter.

SpreeMultiLingual depends on a fork of routing-filter because it supports :exclude option in routes, used for /admin. I hope it this feature can me merged into the original repo.

TODO

  1. Make taxons multi languages editable from the taxonomy tree
  2. Dynamically show taxon full permalink depending on dropdown language selected : Taxons#edit
  3. Add things to translate:
    • Option values
    • Properties
    • Alt text on images
  4. Dropdown or something to change locale
  5. Rake task for store that already have users

Contributors

Special thanks to sbounmy for the amount of contributions he did. Thanks to Radar for merging spree_localize.

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

$ bundle
$ bundle exec rake test app
$ bundle exec rspec spec

Copyright (c) 2012 Jean-Philippe Boily, released under the New BSD License

spree_multi_lingual's People

Contributors

matteofuzz avatar pigoz avatar radar avatar sbounmy avatar

Stargazers

 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.