Giter Site home page Giter Site logo

zencocoon / i18n_multi_locales_validations Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 1.0 85 KB

i18n_multi_locales_validations facilitates multi-locales attributes validations. It's made to validates attributes from Globalize2 translations models.

License: MIT License

i18n_multi_locales_validations's Introduction

I18n Multi Locales Validations
==============================

i18n_multi_locales_validations is a plugin by Sébastien Grosjean (aka ZenCocoon <http://zencocoon.com>)


I18n Multi Locales Validations functionality
============================================

i18n_multi_locales_validations facilitates multi-locales attributes validations. It's made to validates attributes from Globalize2 translations models.


Requirement
===========

It requires :

* Rails 2.3 (or Rails 2.2 with I18n.available_locales patch)
* Globalize2 with this patches on top
** http://globalize2.lighthouseapp.com/projects/15085/tickets/9-patch-tested-allow-to-specify-locale-as-variable
** http://globalize2.lighthouseapp.com/projects/15085/tickets/6-add-locale-parameter-to-setters


WARNING
=======

This is still under heavy development, use at your own risk

NOTICE : Error message are still not properly handled as doesn't refer to the specific locale


I18n Multi Locales Validations usage
====================================

Just add the option :locale => YOUR_LOCALE to your validations.

eg: 

# in models
validates_presence_of :title, :locale => :"fr"
validates_presence_of :title, :locale => [ :"fr", :"de" ]
validates_presence_of :title, :locale => :all # This will validates for all locales found with I18n.available_locales


I18n Multi Locales Validations effect
=====================================

The plugin overwrite few methods from ActiveRecord::Errors and ActiveRecord::Validations::ClassMethods
To have a better understanding of what it does, the best way is still to look at the code
itself.

Copyright (c) 2009 Sébastien Grosjean, released under the MIT license

i18n_multi_locales_validations's People

Contributors

zencocoon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

paolochiodi

i18n_multi_locales_validations's Issues

Don't work with globalize2 v0.1.1

Hi Sébastien!

How can I change i18n_multi_locales_validations and i18n_multi_locales_form to work with globalize2 v0.1.1 and Rails 2.3.8 and Rails 3? Globalize2 version v0.1.1 has change code in many places...

Your approach to add validations in globalize2 is very good and should be made forward.

Cheers

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.