Code Monkey home page Code Monkey logo

solidus_i18n's Introduction

Solidus Internationalization

CircleCI Code Climate Gem Version

This is the Internationalization project for Solidus


Changes in Version 2.0

solidus_i18n Version 2.0+ only contains translation files.

Previous versions of solidus_i18n included extra functionality like locale selectors and which is now built in to Solidus 2.6+. Configuration for routing-filter has also been removed and must be configured manually (See Locale in URL).

Installation

Add the following to your Gemfile:

gem 'solidus_i18n', '~> 2.0'
gem 'rails-i18n', '~> 5.1'
gem 'kaminari-i18n', '~> 0.5.0'

Locale in URL

Older versions of solidus_i18n included the routing-filter gem and configured routes to include the locale in the URL. This is still supported (maybe even recommended) but requires some additional configuration.

  1. Add this gem to your Gemfile, then run bundle install
gem 'routing-filter', '~> 0.6.0'
  1. Add filter :locale to your config/routes.rb
Rails.application.routes.draw do
  filter :locale

  mount Spree::Core::Engine, at: '/'
end
  1. Configure routing-fitler in config/initializers/locale_filter.rb (optional)
# Do not include the default locale in the URL
RoutingFilter::Locale.include_default_locale = false

Supported languages

We currently support the following locales by default. If you need a locale that is not in the list you can add a custom translation file into your application by following the Rails translations guide.

Updating Translations

If you want to improve the translations on your language, run the tasks:

bundle exec rake solidus_i18n:update_default
bundle exec i18n-tasks add-missing --nil-value --locale <LOCALE>

Substitute with your locale code (e.g: it).

This will do a cleanup and prepare <LOCALE>.yml with all the missing keys. You can then write the translations and open a pull request.

Model Translations

We removed support for translating models into a separate Gem.

Please update your Gemfile if you still need the model translations.

# Gemfile
gem 'solidus_globalize', github: 'solidusio-contrib/solidus_globalize', branch: 'master'

Localizing country names

You can translate country names by defining spree.country_names in your own locale files. For example, to have countries in Spanish do:

es:
  spree:
    country_names:
      US: Estados Unidos de América
      UK: Reino Unido
      CA: Canadá
      # ...

Some supported languages already define localized country names. Take a look at this repo's .yml files for your locale to confirm if we already provide translations.

Contributing

Solidus is an open source project and we encourage contributions. Please read CONTRIBUTING.md before contributing.

solidus_i18n's People

Contributors

huoxito avatar greendog avatar jhawthorn avatar futhr avatar radar avatar jdutil avatar alepore avatar schof avatar tvdeyen avatar reinaris avatar coorasse avatar romul avatar kennyadsl avatar mamhoff avatar danielepalombo avatar camelmasa avatar tka avatar jpavello avatar fredericboivin avatar pusewicz avatar kagetsuki avatar adhlssu07 avatar tobiashm avatar peterberkenbosch avatar cbilgili avatar daan- avatar spaghetticode avatar maxim-filimonov avatar geekoncoffee avatar sadfuzzy avatar

Watchers

James Cloos 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.