pax_global_header00006660000000000000000000000064121477265360014527gustar00rootroot0000000000000052 comment=79b057bb21fd015f8b2482c764897e890cb34b92 ruby-i18n-inflector-rails-1.0.6/000077500000000000000000000000001214772653600163645ustar00rootroot00000000000000ruby-i18n-inflector-rails-1.0.6/.gemtest000066400000000000000000000000001214772653600200230ustar00rootroot00000000000000ruby-i18n-inflector-rails-1.0.6/.rspec000066400000000000000000000000301214772653600174720ustar00rootroot00000000000000--format nested --color ruby-i18n-inflector-rails-1.0.6/.yardopts000066400000000000000000000002351214772653600202320ustar00rootroot00000000000000--title 'Simple Inflector for I18n' --protected --readme README.rdoc --no-private --hide-void-return - docs/HISTORY ChangeLog docs/COPYING docs/LGPL-LICENSE ruby-i18n-inflector-rails-1.0.6/ChangeLog000066400000000000000000000207411214772653600201420ustar00rootroot00000000000000commit d0ef3e273d3cec561e252830aaf0eb44e0820807 Author: Paweł Wilk Date: Mon Aug 8 00:14:01 2011 +0200 Release 1.0.5 commit b344f7d41c640ca75a274fb635a96ad969ae5fe3 Author: Paweł Wilk Date: Sun Jul 10 03:35:29 2011 +0200 Release 1.0.4 commit 7953d129789877ca248e7aa0771a587181853c4a Merge: 34f876d fff4d8c Author: Paweł Wilk Date: Sat Jul 9 23:14:45 2011 +0200 Merge branch 'master' of github.com:siefca/i18n-inflector-rails commit 34f876d027f1fc49d8c63ec576bf4c8952c91d45 Author: Paweł Wilk Date: Sat Mar 5 14:30:04 2011 +0100 Added note about YAML parsing issues. commit 1aca5303d43bf300a8b802d6f69664f15522f699 Author: Paweł Wilk Date: Wed Feb 23 23:23:33 2011 +0100 Release 1.0.3 commit fff4d8c91fa4f9172b7336e12126ec43145f0cf6 Author: Paweł Wilk Date: Wed Feb 23 23:23:33 2011 +0100 Release 1.0.3 commit 1a7516470ddb82cde000188bb632e7e40166d594 Author: Paweł Wilk Date: Wed Feb 23 23:23:04 2011 +0100 Requires bugfixed i18n-inflector commit 1360542f0cf6d3cbce6577a62330697ffb8e4dca Author: Paweł Wilk Date: Wed Feb 23 01:12:13 2011 +0100 Release 1.0.2 commit 9ea4414d555a719cabb3521f0da66652ec3ee782 Author: Paweł Wilk Date: Wed Feb 23 01:08:44 2011 +0100 Applied workaround for Ruby 1.8.x bug #734 in t() alias commit 696d8f4ef50ae54fd0017a96a3750af56ce2cb56 Author: Paweł Wilk Date: Tue Feb 15 14:50:13 2011 +0100 Release 1.0.1 commit 5ee55b3ea54cfa86e541a47f27cbe321932c3820 Author: Paweł Wilk Date: Tue Feb 15 01:38:13 2011 +0100 Release 1.0.0 commit 46377c25557637e0f576a637b6abd203555989da Author: Paweł Wilk Date: Tue Feb 15 01:09:46 2011 +0100 Documentation updated commit f3419fd70560927aec82813e25d6dd4d33e6e629 Author: Paweł Wilk Date: Tue Feb 15 01:09:07 2011 +0100 Specification updated commit 8c2907f62a9273a66bc5be0e90da92c0299d1e72 Author: Paweł Wilk Date: Tue Feb 15 01:07:53 2011 +0100 ClassMethods and InflectedTranslate refactored - There are no additional Procs support, but Inflector's inflection methods may take arguments. - Translation method now makes use of lazy methods feature of I18n Inflector. - The internal hash is now i18n_inflector_kinds and it's indexed by kinds. - Rewritten argument parsing for inflection_method. - Added no_inflection_method_for (aka no_inflection_kind). commit aee2f6f484bee1812ecf8765b28d910adc8412e5 Author: Paweł Wilk Date: Tue Feb 15 00:58:53 2011 +0100 New switches are now added by opening the InflectionOptions class, added new switch :lazy_methods commit 938f7bf971d8c00710b2202dc15e37929f8391dc Author: Paweł Wilk Date: Mon Jan 17 15:01:07 2011 +0100 Link in documentation fixed commit 15e330e957f34579fa95aa2036f0c06fd168ab54 Author: Paweł Wilk Date: Sun Jan 16 07:06:57 2011 +0100 Documentation updated commit e10a3bbbc25c053529976d82a0304819b7235213 Author: Paweł Wilk Date: Sun Jan 16 07:02:19 2011 +0100 additional_options.rb renamed to options.rb, HISTORY updated commit 097cc40da6bd9edec7231dd96a7b3197c5133888 Author: Paweł Wilk Date: Sun Jan 16 06:46:28 2011 +0100 Added conditional checking if method to be called exists, dependencies fixed commit 807a61dea750e19bd52fb350d34609e259557bbd Author: Paweł Wilk Date: Fri Jan 14 18:05:40 2011 +0100 Version 0.1.0 commit 5cd0488a4c5e4bab9f9719162af599984e83d71f Author: Paweł Wilk Date: Fri Jan 14 13:04:43 2011 +0100 Adapted to i18n-inflector v.2.0.0 commit 20c389bbb9fcae1d216a22b6df39aebd90210767 Author: Paweł Wilk Date: Tue Jan 11 14:17:45 2011 +0100 Requires stable i18n-inflector commit 01e743e18f55b8734107124303ed191c60937f99 Author: Paweł Wilk Date: Tue Jan 11 14:04:05 2011 +0100 Version 0.1.0 commit c985de4af92f1d1619cfb228ae378d5ca383babd Author: Paweł Wilk Date: Tue Jan 11 13:55:45 2011 +0100 Beta commit f338a6a56f36eed25f831d6fbc3fe0127a08931b Author: Paweł Wilk Date: Tue Jan 11 08:28:52 2011 +0100 Serious changes that are making it work in a real Rails 3 environment commit 528fcb11daee63711dae36fa6b3b97bd2ab25370 Author: Paweł Wilk Date: Tue Jan 11 08:27:43 2011 +0100 Added no_inflection_method class method, each added method becomes a helper method commit 17d35aae4c269663b44277751e2d45260abb3c56 Author: Paweł Wilk Date: Sun Jan 9 21:03:50 2011 +0100 Path fixed commit 289c85c00008b67584e30eb170ce173c35187e84 Author: Paweł Wilk Date: Sun Jan 9 21:00:40 2011 +0100 Updated Manifest.txt and ChangeLog commit 75b492579a8d25ab3e48a7795a1f351f2f7b379c Author: Paweł Wilk Date: Sun Jan 9 20:58:49 2011 +0100 Moved gemspec to root commit c58191d99e80b28d045fd48e14689b0cf4bc49cb Author: Paweł Wilk Date: Sun Jan 9 20:56:04 2011 +0100 Added important note to gemspec commit 7fa840a3522b19bb2db9231acdb21faeaedcbfbd Author: Paweł Wilk Date: Sun Jan 9 20:46:16 2011 +0100 Specfile fixed: removed non-existent files commit b660e57b969cdb57248a111585278cd20ebbee7a Author: Paweł Wilk Date: Sun Jan 9 20:13:29 2011 +0100 Specfile renamed commit 81cffc37a6b30fc7595bb26643588bce1db62da7 Author: Paweł Wilk Date: Sun Jan 9 20:12:24 2011 +0100 Repository name changed to i18n-inflector-rails commit cda3edcffe9465e021af8380af3ceae0f98ef0a8 Author: Paweł Wilk Date: Sun Jan 9 07:11:22 2011 +0100 Dependencies fixed commit c1ce77a843490b21233f0c60b35c64d4df731834 Author: Paweł Wilk Date: Sun Jan 9 06:45:48 2011 +0100 Dependencies back to gemspec commit 745815d7047d7cc39ec48c9265714c110527fc1e Author: Paweł Wilk Date: Sun Jan 9 06:25:45 2011 +0100 Call it beta commit a3bf341ae100885b39e770d7cc91ebe7a9734a22 Author: Paweł Wilk Date: Sun Jan 9 06:23:37 2011 +0100 Dependencies cleaned, gemspec and Rakefile independent from module code (added version.rb for that) commit 5583b7ac968d999ba2a74b3d8457c29df0afba9d Author: Paweł Wilk Date: Sun Jan 9 02:26:43 2011 +0100 Gemspec upgraded commit 2c754d88f34bb41b5a377c8f9108687157dca08a Author: Paweł Wilk Date: Sun Jan 9 02:24:14 2011 +0100 Added gemspec for compatibility commit 2eebc9668e1b05ac65342ebf8ebb2ded0ac80589 Author: Paweł Wilk Date: Sun Jan 9 01:37:12 2011 +0100 Deps fixed, Rakefile updated commit 84e8c52a61642a9d5d4f24aa354ea2384bfbf817 Author: Paweł Wilk Date: Sun Jan 9 01:18:07 2011 +0100 Namespace changed (removed "Backend"), documentation updated commit 037edac820723b7c7452c2f0eae8f572558bb1ad Author: Paweł Wilk Date: Sat Jan 8 16:48:21 2011 +0100 Deps updated commit 66c6be2be85b56e88fd27a0cdc0ee34dbbdb846b Author: Paweł Wilk Date: Thu Jan 6 23:15:05 2011 +0100 Unit tests stubs removed commit 41e9409414c75f5b5ef77e69ce62a291d321d04f Author: Paweł Wilk Date: Thu Jan 6 23:13:45 2011 +0100 Added Railtie, added common files for older Rails versions just in case commit 818027d17d91171499b410e2e7628422e61eb165 Author: Paweł Wilk Date: Thu Jan 6 23:12:42 2011 +0100 Added rspec examples commit f564dc4c25060961b2838ddae03056fbb9f5fa2a Author: Paweł Wilk Date: Thu Jan 6 23:11:49 2011 +0100 Method names changed, inflection options extraction fixed, documentation updated. commit e0f0fd9086b00efec6e1e979c0a8ea2d03904371 Author: Paweł Wilk Date: Thu Jan 6 23:09:46 2011 +0100 Fixed error reporting class: message is more generic commit fc1c7ea3aa2d4011075d05926fcc8baa5758f322 Author: Paweł Wilk Date: Thu Jan 6 23:09:09 2011 +0100 Dependences changed: railties and rspec-rails added commit cf63e0e3b0cf0388c11143bbe67868b8fbd5bdd9 Author: Paweł Wilk Date: Sun Jan 2 16:03:20 2011 +0100 Added ChangeLog and Manifest.txt commit 4dfee2aa8b56922e4bfc8bd8d2a64456cde256c6 Author: Paweł Wilk Date: Sun Jan 2 16:01:46 2011 +0100 Initial revision ruby-i18n-inflector-rails-1.0.6/Gemfile000066400000000000000000000011511214772653600176550ustar00rootroot00000000000000# -*- ruby -*- # DO NOT EDIT THIS FILE. Instead, edit Rakefile, and run `rake bundler:gemfile`. source :gemcutter gem "i18n-inflector", "~>2.6" gem "railties", "~>3.0" gem "actionpack", "~>3.0" gem "hoe-yard", ">=0.1.2", :group => [:development, :test] gem "rspec", ">=2.6.0", :group => [:development, :test] gem "yard", ">=0.7.2", :group => [:development, :test] gem "rdoc", ">=3.8.0", :group => [:development, :test] gem "bundler", ">=1.0.10", :group => [:development, :test] gem "hoe-bundler", ">=1.1.0", :group => [:development, :test] gem "hoe", "~>2.10", :group => [:development, :test] # vim: syntax=ruby ruby-i18n-inflector-rails-1.0.6/LGPL-LICENSE000066400000000000000000000172061214772653600201330ustar00rootroot00000000000000 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ruby-i18n-inflector-rails-1.0.6/Manifest.txt000066400000000000000000000007021214772653600206720ustar00rootroot00000000000000.rspec .yardopts ChangeLog Gemfile LGPL-LICENSE Manifest.txt README.rdoc Rakefile docs/COPYING docs/HISTORY docs/LEGAL docs/LGPL-LICENSE docs/TODO docs/rdoc.css i18n-inflector-rails.gemspec init.rb lib/i18n-inflector-rails.rb lib/i18n-inflector-rails/errors.rb lib/i18n-inflector-rails/inflector.rb lib/i18n-inflector-rails/options.rb lib/i18n-inflector-rails/railtie.rb lib/i18n-inflector-rails/version.rb spec/inflector_spec.rb spec/spec_helper.rb ruby-i18n-inflector-rails-1.0.6/README.rdoc000066400000000000000000000131441214772653600201750ustar00rootroot00000000000000= Simple I18n Inflector for Rails i18n-inflector-rails version 1.0 (Rain) * https://rubygems.org/gems/i18n-inflector-rails * https://github.com/siefca/i18n-inflector-rails/tree * mailto:pw@gnu.org == Summary This Rails plug-in contains bindings for the I18n Inflector module for Ruby's I18n. It overwrites the translate() method from Rails in a way that it will interpolate additional inflection tokens present in translations. These tokens may appear in *patterns* which are contained within @{ and } symbols. == Why? It's intended to be used in a projects where tranlations are performed by many people, yet there is a need to inflect sentences or words by user's gender, person or other data. To achieve similar functionality lambdas can be used but including Proc objects in translations may be considered unsafe. If you have a troop of happy translators that shouldn't have the ability to execute any code yet you need some simple inflection then this plug-in might help you. == Synopsis translate('.welcome') ===== In a YAML file: en: welcome: "Dear @{f:Lady|m:Sir|n:You|All}" en: i18n: inflections: gender: f: "female" m: "male" n: "neuter" female: @f male: @m neuter: @n man: @male woman: @female default: n ===== In a controller: class ApplicationController < ActionController::Base inflection_method :gender # assuming that @gender is set somewhere def gender @gender || nil end end class UsersController < ApplicationController # t() will call method gender() from the current context # to get the inflection token def say_welcome t('welcome') # => "Dear Sir" end end == Description You can create your own kinds (gender, title, person, time, author, etc.) of tokens to group them in a meaningful, semantical sets. This plug-in adds {I18n::Inflector::Rails::ClassMethods#inflection_method inflection_method}, {I18n::Inflector::Rails::ClassMethods#no_inflection_method no_inflection_method} and {I18n::Inflector::Rails::ClassMethods#no_inflection_method_for no_inflection_method_for} clauses that can be used in controllers and views. Using that clauses makes it easy to register methods that will be called to obtain certain inflection options. It is also possible to set up an inflection method for a so called strict kind commonly used in a so called named and complex patterns. This plug-in uses i18n-inflector[https://rubygems.org/gems/i18n-inflector] module which allows passing inflection options to the translate method. You may find I18n Inflector's API and a default object very helpful since they allow you to read inflection data in many different ways. You might, for example, use it to generate forms containing lists of languages that are using inflection, or to view all known inflection kinds or tokens assigned to them. To access the Inflector object bound to default I18n backend use: I18n.inflector == Note about YAML parsing The previous example is not compatible with Psych parser, which is used by Rails 3. There are two ways to solve that problem. First is to change a YAML file and replace any value that has special meaning with a symbol: en: i18n: inflections: gender: f: "female" m: "male" n: "neuter" female: :@f male: :@m neuter: :@n man: :@male woman: :@female default: :n Second way is to use other parser by adding to +config/boot.rb+: require 'yaml' YAML::ENGINE.yamler = 'syck' == Requirements * i18n-inflector[https://rubygems.org/gems/i18n-inflector] * actionpack[https://rubygems.org/gems/actionpack] * rake[https://rubygems.org/gems/rake] * rubygems[http://docs.rubygems.org/] == Download ==== Source code * https://github.com/siefca/i18n-inflector-rails/tree * git clone git://github.com/siefca/i18n-inflector-rails.git ==== Gem * https://rubygems.org/gems/i18n-inflector-rails == Installation * gem install i18n-inflector-rails == Specs You can run RSpec examples both with * rake spec or just rake * run a test file directly, e.g. ruby -Ilib -Ispec spec/inflector_spec.rb == More information See {I18n::Inflector::Rails::ClassMethods} to learn how to use +inflection_method+ and +no_inflection_method+. See {I18n::Inflector::Rails::InflectedTranslate} to learn about using the translation wrapper. See {I18n::Inflector::InflectionOptions} to know more about switches that can be used to control the engine. See the {whole documentation}[http://rubydoc.info/gems/i18n-inflector-rails/] for more information. To know how the basics and to learn more about Inflector that is used by this plug-in see {I18n Inflector documentation}[http://rubydoc.info/gems/i18n-inflector]. == Credits {Heise Media Polska}[http://www.heise-online.pl/] supports Free Software and has contributed to this plug-in by paying for me to eat when I've been coding. == License Copyright (c) 2011 by Paweł Wilk. i18n-inflector-rails is copyrighted software owned by Paweł Wilk (pw@gnu.org). You may redistribute and/or modify this software as long as you comply with either the terms of the LGPL (see {file:LGPL-LICENSE}), or Ruby's license (see {file:COPYING}). THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ruby-i18n-inflector-rails-1.0.6/Rakefile000066400000000000000000000046251214772653600200400ustar00rootroot00000000000000# encoding: utf-8 # -*- ruby -*- $:.unshift File.join(File.dirname(__FILE__), "lib") require 'rubygems' require 'bundler/setup' require "rake" require "rake/clean" require "fileutils" require "i18n-inflector" require 'i18n-inflector-rails/version' require 'hoe' task :default => [:test] desc "install by setup.rb" task :install do sh "sudo ruby setup.rb install" end ### Gem if !defined?(YAML::ENGINE).nil? && YAML::ENGINE.respond_to?(:yamler) YAML::ENGINE.yamler = 'syck' end Hoe.plugin :bundler Hoe.plugin :yard Hoe.spec 'i18n-inflector-rails' do developer I18n::Inflector::Rails::DEVELOPER, I18n::Inflector::Rails::EMAIL self.version = I18n::Inflector::Rails::VERSION self.rubyforge_name = I18n::Inflector::Rails::NAME self.summary = I18n::Inflector::Rails::SUMMARY self.description = I18n::Inflector::Rails::DESCRIPTION self.url = I18n::Inflector::Rails::URL self.remote_rdoc_dir = '' self.rsync_args << '--chmod=a+rX' self.readme_file = 'README.rdoc' self.history_file = 'docs/HISTORY' extra_deps << ['i18n-inflector', '~> 2.6'] << ['railties', '~> 3.0'] << ['actionpack', '~> 3.0'] extra_dev_deps << ['rspec', '>= 2.6.0'] << ['yard', '>= 0.7.2'] << ['rdoc', '>= 3.8.0'] << ['bundler', '>= 1.0.10'] << ['hoe-bundler', '>= 1.1.0'] unless extra_dev_deps.flatten.include?('hoe-yard') extra_dev_deps << ['hoe-yard', '>= 0.1.2'] end end task 'Manifest.txt' do puts 'generating Manifest.txt from git' sh %{git ls-files | grep -v gitignore > Manifest.txt} sh %{git add Manifest.txt} end task 'ChangeLog' do sh %{git log > ChangeLog} end desc "Fix documentation's file permissions" task :docperm do sh %{chmod -R a+rX doc} end ### Sign & Publish desc "Create signed tag in Git" task :tag do sh %{git tag -s v#{I18n::Inflector::Rails::VERSION} -m 'version #{I18n::Inflector::Rails::VERSION}'} end desc "Create external GnuPG signature for Gem" task :gemsign do sh %{gpg -u #{I18n::Inflector::Rails::EMAIL} -ab pkg/#{I18n::Inflector::Rails::NAME}-#{I18n::Inflector::Rails::VERSION}.gem \ -o pkg/#{I18n::Inflector::Rails::NAME}-#{I18n::Inflector::Rails::VERSION}.gem.sig} end ruby-i18n-inflector-rails-1.0.6/data.tar.gz.sig000066400000000000000000000004001214772653600211770ustar00rootroot00000000000000XY\G9h) K꼚_ DTFgeDor& T01x1 ͋/#D%FUhEi YFɅƸ!z/8"v 'sb+Է]d%'y؈Hx40e lUq:eźEMP{7X-din]_4O[YJ}ȉxWF6hruby-i18n-inflector-rails-1.0.6/docs/000077500000000000000000000000001214772653600173145ustar00rootroot00000000000000ruby-i18n-inflector-rails-1.0.6/docs/COPYING000066400000000000000000000047051214772653600203550ustar00rootroot00000000000000i18n-inflector-rails is copyrighted free software owned by Paweł Wilk (pw@gnu.org). The Owner of this software permits you to redistribute and/or modify the software under either the terms of the LGPL version 3 (see the file {file:LGPL-LICENSE LGPL-LICENSE}), or the conditions below ("Ruby License"). == 1. You may make and give away verbatim copies of the source form of this software without restriction, provided that you retain ALL of the original copyright notices and associated disclaimers. == 2. You may modify your copy of the software in any way, provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or by allowing the author to include your modifications in the software. b) use the modified software only within your corporation or organization. c) give non-standard binaries non-standard names, with instructions on where to get the original software distribution. d) make other distribution arrangements with the Owner. == 3. You may distribute the software in object code or binary form, provided that you do at least ONE of the following: a) distribute the binaries and library files of the software, together with instructions (in a manual page or equivalent) on where to get the original distribution. b) accompany the distribution with the machine-readable source of the software. c) give non-standard binaries non-standard names, with instructions on where to get the original software distribution. d) make other distribution arrangements with the Owner. == 4. You may modify and include parts of the software into any other software (possibly commercial), provided you comply with the terms in Sections 1, 2, and 3 above. But some files in the distribution are not written by the Owner, so they may be made available to you under different terms. For the list of those files and their copying conditions, see the file LEGAL. == 5. The scripts and library files supplied as input to or produced as output from the software do not automatically fall under the copyright of the software, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this software. == 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ruby-i18n-inflector-rails-1.0.6/docs/HISTORY000066400000000000000000000024221214772653600204000ustar00rootroot00000000000000=== 1.0.5 / 2011-08-07 * minor bugfixes * Applied a workaround against a buggy parser in Rubygems === 1.0.4 / 2011-07-09 * minor enhancements * Dependencies updated === 1.0.2 / 2011-02-23 * major bugfixes * Applied workaround for Ruby 1.8.x bug #734 in t() alias === 1.0.1 / 2011-02-14 * major enhancements * Inflection methods evaluation is now lazy; passing Method objects to the Inflector * Added strict kinds (named patterns) better support * Added no_inflection_method_for (alias no_inflection_kind) clause * Changed way that associations are stored from (method => kind) to (kind => method) * Removed block passing support from inflection_method since I18n Inflector supports inflection methods with arguments * minor enhancements * Removed magic symbols from code * Improved arguments parsing in inflection_method * Added auto_helper global switch * Added lazy_methods global switch === 0.2.0 / 2011-01-15 * 1 major enhancement * Added switch that causes any method from current context to be tested if is callable === 0.1.0 / 2011-01-11 * 2 major enhancements * Compatible with Rails 3 * no_inflection_method added; it disables previously added method from using by translate() === 0.0.1 / 2011-01-02 * 1 major enhancement * Birthday! ruby-i18n-inflector-rails-1.0.6/docs/LEGAL000066400000000000000000000005761214772653600200730ustar00rootroot00000000000000LEGAL NOTICE INFORMATION ------------------------ i18n-inflector-rails is Copyright (C) 2011 by Paweł Wilk. i18n-inflector-rails is copyrighted software owned by Paweł Wilk (pw@gnu.org). You may redistribute and/or modify this software as long as you comply with either the terms of the LGPL (see the file {file:LGPL-LICENSE}), or Ruby's license (see the file {file:COPYING}). ruby-i18n-inflector-rails-1.0.6/docs/LGPL-LICENSE000066400000000000000000000163351214772653600210650ustar00rootroot00000000000000 = GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. < http://fsf.org/ > Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. === 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. === 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. === 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. === 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. === 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) === 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. === 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. ruby-i18n-inflector-rails-1.0.6/docs/TODO000066400000000000000000000000741214772653600200050ustar00rootroot00000000000000 * write more real specs with full Rails 3 stack simulation ruby-i18n-inflector-rails-1.0.6/docs/rdoc.css000066400000000000000000000006141214772653600207560ustar00rootroot00000000000000@import "rdoc_base.css"; #documentation > ul:first-of-type { padding-bottom: 2em; padding-top: 1.5em; background-position: 20em 0%; background-repeat: no-repeat; } #documentation .method-description > p:first-of-type + p { margin-top: 0.5em; } #documentation .method-description > ul { margin-left: 1.2em; } #documentation .method-description > p + ul { margin-left: 1.8em; } ruby-i18n-inflector-rails-1.0.6/i18n-inflector-rails.gemspec000066400000000000000000000032511214772653600236040ustar00rootroot00000000000000# encoding: utf-8 # This is just a helper file for those including directly from sources. # Real building follows the instructions in the hoe section of Rakefile. lib = File.expand_path('../lib/', __FILE__) $:.unshift lib unless $:.include?(lib) require 'i18n-inflector-rails/version' if !defined?(YAML::ENGINE).nil? && YAML::ENGINE.respond_to?(:yamler) YAML::ENGINE.yamler = 'syck' end Gem::Specification.new do |s| s.name = I18n::Inflector::Rails::NAME s.version = I18n::Inflector::Rails::VERSION s.authors = [I18n::Inflector::Rails::DEVELOPER] s.email = I18n::Inflector::Rails::EMAIL s.homepage = I18n::Inflector::Rails::URL s.summary = I18n::Inflector::Rails::SUMMARY s.description = I18n::Inflector::Rails::DESCRIPTION s.files = Dir.glob("{ci,lib,spec,docs}/**/**") + %w(init.rb Gemfile .rspec .yardopts README.rdoc LGPL-LICENSE ChangeLog Manifest.txt) s.extra_rdoc_files = ["README.rdoc", "docs/HISTORY", "docs/LGPL-LICENSE", "docs/COPYING"] s.rdoc_options = ["--main", "README.rdoc", "--charset=UTF-8"] s.platform = Gem::Platform::RUBY s.require_path = 'lib' s.rubyforge_project = '[none]' s.required_rubygems_version = '>= 1.4.0' s.specification_version = 3 s.add_dependency 'i18n-inflector', '~> 2.6' s.add_dependency 'railties', '~> 3.0' s.add_dependency 'actionpack', '~> 3.0' s.add_development_dependency 'rspec', '>= 2.6.0' s.add_development_dependency 'yard', '>= 0.7.2' s.add_development_dependency 'bundler', '>= 1.0.10' s.add_development_dependency 'hoe-bundler', '>= 1.1.0' s.add_development_dependency 'hoe-yard', '>= 0.1.2' end ruby-i18n-inflector-rails-1.0.6/init.rb000066400000000000000000000000371214772653600176540ustar00rootroot00000000000000require 'i18n-inflector-rails' ruby-i18n-inflector-rails-1.0.6/lib/000077500000000000000000000000001214772653600171325ustar00rootroot00000000000000ruby-i18n-inflector-rails-1.0.6/lib/i18n-inflector-rails.rb000077500000000000000000000015571214772653600233440ustar00rootroot00000000000000# encoding: utf-8 require 'i18n-inflector' require 'i18n-inflector-rails/version' require 'i18n-inflector-rails/errors' require 'i18n-inflector-rails/options' require 'i18n-inflector-rails/inflector' if defined? Rails::Engine require 'i18n-inflector-rails/railtie' else if not defined? ActionController::Base require 'active_support/core_ext/module/deprecation' # workaround for Rails missing require require 'action_controller' end require 'action_view' if not defined? ActionView::Base ActionController::Base.send(:extend, I18n::Inflector::Rails::ClassMethods) ActionController::Base.send(:include, I18n::Inflector::Rails::InstanceMethods) ActionController::Base.send(:include, I18n::Inflector::Rails::InflectedTranslate) if ActionController::Base.respond_to?(:helper_method) ActionController::Base.helper_method :translate end end ruby-i18n-inflector-rails-1.0.6/lib/i18n-inflector-rails/000077500000000000000000000000001214772653600230045ustar00rootroot00000000000000ruby-i18n-inflector-rails-1.0.6/lib/i18n-inflector-rails/errors.rb000066400000000000000000000013401214772653600246430ustar00rootroot00000000000000# encoding: utf-8 # # Author:: Paweł Wilk (mailto:pw@gnu.org) # Copyright:: (c) 2011 by Paweł Wilk # License:: This program is licensed under the terms of {file:LGPL-LICENSE GNU Lesser General Public License} or {file:COPYING Ruby License}. # # This file contains error reporting classes for I18n::Backend::Inflector module. module I18n module Inflector module Rails # This class is for reporting bad inflection method # in the given assignment. class BadInflectionMethod < I18n::ArgumentError attr_reader :assignment def initialize(assignment) @assignment = assignment super "The given assignment is invalid: #{assignment}" end end end end end ruby-i18n-inflector-rails-1.0.6/lib/i18n-inflector-rails/inflector.rb000066400000000000000000000413551214772653600253260ustar00rootroot00000000000000# encoding: utf-8 # # Author:: Paweł Wilk (mailto:pw@gnu.org) # Copyright:: (c) 2011 by Paweł Wilk # License:: This program is licensed under the terms of {file:LGPL-LICENSE GNU Lesser General Public License} or {file:COPYING Ruby License}. # # This file contains I18n::Backend::Inflector::Rails module, # which extends ActionView::Helpers::TranslationHelper # by adding the ability to interpolate patterns containing # inflection tokens defined in translation data. module I18n # @abstract It is defined in {I18n Inflector library}[http://rubydoc.info/gems/i18n-inflector]. module Inflector module Rails # This module contains instance methods for ActionController. module InstanceMethods # This method calls the class method {I18n::Inflector::Rails::ClassMethods#i18n_inflector_kinds} def i18n_inflector_kinds self.class.i18n_inflector_kinds end # @private def self.included(base) base.helper_method(:i18n_inflector_kinds) end end # instance methods # This module contains class methods for ActionController. module ClassMethods # This method reads the internal Hash +i18n_inflector_kinds+ containing registered # inflection methods and the assigned kinds. It also reads any methods # assignments that were defined earlier in the inheritance path and # merges them with current results; the most current entries will # override the entries defined before. # # @api public # @return [Hash] the Hash containing assignments made by using {#inflection_method} def i18n_inflector_kinds prev = superclass.respond_to?(:i18n_inflector_kinds) ? superclass.i18n_inflector_kinds : {} return @i18n_inflector_kinds.nil? ? prev : prev.merge(@i18n_inflector_kinds) end # This method allows to assign methods (typically attribute readers) # to inflection kinds that are defined in translation files and # supported by {I18n::Inflector} module. Methods registered like that # will be tracked when {translate} is used and their returning values will be # passed as inflection options along with assigned kinds. If the kind is not # given then method assumes that the name of a kind is the same as the given # name of a method. # # If the given kind begins with +@+ then strict kind is assumed. If there is # no kind given but the given method name begins with +@+ character then # also strict kind of the same name is assumed but method name is memorized # without the leading symbol. # # Registering method for feeding an inflection option describing a strict # kind might be good idea when using some regular kind of the same name, # but note that regular kind inflection option is also tried by the # translation method when strict kind is in use. # # In case of registering two methods of different # names but assigned to kind and to a strict kind using the same base name, # a named inflection pattern will first use an inflection option obtained # from a method assigned to a strict kind. Note that it is impossible # to use short formed +inflection_method+ calls to register a method for both # strict and regular inflection kind, since the method names will be the # same and the second call will overwrite the first one. # # @example Registering an inflection method for the kind gender visible in a whole application # class ApplicationController < ActionController::Base # inflection_method :gender # […] # end # # @example Registering an inflection method for the strict kind @gender visible in a whole application # class ApplicationController < ActionController::Base # inflection_method :@gender # […] # end # # @example Registering a custom-named inflection method for the kind gender # class ApplicationController < ActionController::Base # inflection_method :get_user_gender => :gender # […] # end # # @example Registering a custom-named inflection methods for the kinds gender and tense # class ApplicationController < ActionController::Base # inflection_method :get_user_gender => :gender, :get_tense => :tense # […] # end # # @example Registering inflection methods for the kinds gender and tense # class ApplicationController < ActionController::Base # inflection_method :gender, :tense # […] # end # # @example Registering inflection methods for the kind gender and the strict kind @tense # class ApplicationController < ActionController::Base # inflection_method :gender, :@tense # […] # end # # @example Registering a custom-named inflection methods for the kinds gender and @gender # # in case of named patterns the method get_strict_gender and the # # strict kind @gender will have priority; the regular kind gender # # and its method would be used if there would be no strict variants # class ApplicationController < ActionController::Base # inflection_method :get_gender => :gender, :get_strict_gender => :@gender # […] # end # # @example Registering a method for the kind gender and the custom-named method for the kind @gender # class ApplicationController < ActionController::Base # inflection_method :gender, :get_strict_gender => :@gender # […] # end # # @example Registering a method for the kind gender visible in whole app and a variant for some controller # class ApplicationController < ActionController::Base # inflection_method :gender # […] # end # # # In this controller the method gender will be called # # to obtain inflection option's value for the kind gender # class UsersController < ApplicationController # end # # # In this controller the method getit will be called # # to obtain inflection option's value for the kind gender # class OtherController < ApplicationController # inflection_method :getit => :gender # end # # # In this controller no method will be called # # to obtain inflection option's value for the kind gender # class FlowersController < ApplicationController # no_inflection_method :getit # end # # @api public # @note Any added method will become a helper unless {I18n::Inflector::InflectionOptions#auto_helper} swtich is set to +false+! # @raise [I18n::Inflector::Rails::BadInflectionMethod] when the given name or value are malformed # @param [Hash{Symbol => Symbol},Array,Symbol,String] *args the methods and inflection kinds assigned to them # @return [void] def inflection_method(*args) args = args.flatten if args.empty? raise I18n::Inflector::Rails::BadInflectionMethod.new(assignment) end assignment = {} args.each do |e| if (e.is_a?(Symbol) || e.is_a?(String)) assignment[e] = e elsif e.is_a?(Hash) raise I18n::Inflector::Rails::BadInflectionMethod.new(assignment) if e.empty? assignment.merge!(e) else raise I18n::Inflector::Rails::BadInflectionMethod.new(assignment) end end @i18n_inflector_kinds ||= {} assignment.each_pair do |method, kind| method = method.to_s if (method.empty? || I18n::Inflector::Config::Reserved::Kinds.invalid?(kind, :OPTION)) raise I18n::Inflector::Rails::BadInflectionMethod.new("#{method.inspect} => #{kind.inspect}") end kind = kind.to_s method = method[1..-1] if (method[0..0] == I18n::Inflector::Config::Markers::PATTERN && method == kind) kind = kind.to_sym method = method.to_sym helper_method(method) if I18n.backend.inflector.options.auto_helper @i18n_inflector_kinds[kind] = method end end alias_method :inflection_methods, :inflection_method # This method unregisters inflection kinds from assignments # created by {inflection_method}. It is useful # when there is a need to break inheritance in some controller, # but there was a method assigned to some inflection kind in # a parrent class. # # @api public # @raise [I18n::Inflector::Rails::BadInflectionMethod] when name or value is bad or malformed # @param [Array] names the method names for which the assigned kinds should be marked as not # supported in a current controller and all derivative controllers # @return [void] def no_inflection_method(*names) names = names.flatten if (names.nil? || names.empty?) raise I18n::Inflector::Rails::BadInflectionMethod.new(names) end @i18n_inflector_kinds ||= {} names.each do |meth| unless (meth.is_a?(Symbol) || meth.is_a?(String)) raise I18n::Inflector::Rails::BadInflectionMethod.new(meth) end meth = meth.to_s meth = meth[1..-1] if meth[0..0] == I18n::Inflector::Config::Markers::PATTERN # for dummies raise I18n::Inflector::Rails::BadInflectionMethod.new(meth) if meth.empty? meth = meth.to_sym i18n_inflector_kinds.each_pair do |kind, obj| if obj == meth @i18n_inflector_kinds[kind] = nil end end end end alias_method :no_inflection_methods, :no_inflection_method # This method unregisters the given inflection kinds from assignments # created by {inflection_method}. It is useful # when there is a need to break inheritance in some controller, # but there was a method assigned to some inflection kind in # a parrent class. # # @api public # @raise [I18n::Inflector::Rails::BadInflectionMethod] when name or value is malformed # @param [String,Symbol,Array] kinds the kind for which the method names should be marked # as not supported in a current controller and all derivative controllers # @return [void] def no_inflection_method_for(*names) names = names.flatten if (names.nil? || names.empty?) raise I18n::Inflector::Rails::BadInflectionMethod.new(names) end @i18n_inflector_kinds ||= {} names.each do |kind| unless (kind.is_a?(Symbol) || kind.is_a?(String)) raise I18n::Inflector::Rails::BadInflectionKind.new(kind) end if (I18n::Inflector::Config::Reserved::Kinds.invalid?(kind, :OPTION) || kind.to_s == I18n::Inflector::Config::Markers::PATTERN) raise I18n::Inflector::Rails::BadInflectionKind.new(kind) end @i18n_inflector_kinds[kind.to_sym] = nil end end alias_method :no_inflection_methods_for, :no_inflection_method_for alias_method :no_inflection_kind, :no_inflection_method_for end # class methods # This module contains a variant of the +translate+ method that # uses {I18n::Inflector::Rails::ClassMethods#i18n_inflector_kinds i18n_inflector_kinds} # available in the current context. # The method from this module will wrap the # {ActionView::Helpers::TranslationHelper#translate} method. module InflectedTranslate # This method tries to feed itself with the data coming # from {I18n::Inflector::Rails::ClassMethods#i18n_inflector_kinds i18n_inflector_kinds} # available in the current context. # That data contains inflection pairs (kind => value) that will # be passed to the interpolation method from {I18n::Inflector} through # {ActionView::Helpers::TranslationHelper#translate}. # # You may also pass inflection options directly, along with other options, # without registering methods responsible for delivering tokens. # See {I18n Inflector documentation}[http://rubydoc.info/gems/i18n-inflector] # for more info about inflection options. # # @api public # @raise {I18n::InvalidInflectionKind} # @raise {I18n::InvalidInflectionOption} # @raise {I18n::InvalidInflectionToken} # @raise {I18n::MisplacedInflectionToken} # @overload translate(key, options) # @param [String] key translation key # @param [Hash] options a set of options to pass to the # translation routines # @option options [Boolean] :inflector_verify_methods (false) local switch # that overrides global setting (see {I18n::Inflector::InflectionOptions#verify_methods}) # @option options [Boolean] :inflector_lazy_methods (true) local switch # that overrides global setting (see {I18n::Inflector::InflectionOptions#lazy_methods}) # @option options [Boolean] :inflector_excluded_defaults (false) local switch # that overrides global setting (see {I18n Inflector documentation}[http://rubydoc.info/gems/i18n-inflector]) # @option options [Boolean] :inflector_unknown_defaults (true) local switch # that overrides global setting (see {I18n Inflector documentation}[http://rubydoc.info/gems/i18n-inflector]) # @option options [Boolean] :inflector_raises (false) local switch # that overrides global setting (see {I18n Inflector documentation}[http://rubydoc.info/gems/i18n-inflector]) # @option options [Boolean] :inflector_aliased_patterns (false) local switch # that overrides global setting (see {I18n Inflector documentation}[http://rubydoc.info/gems/i18n-inflector]) # @option options [Boolean] :inflector_cache_aware (false) local switch # that overrides global setting (see {I18n Inflector documentation}[http://rubydoc.info/gems/i18n-inflector]) # @return [String] the translated string with inflection patterns # interpolated def translate(*args) opts_present = args.last.is_a?(Hash) if opts_present options = args.last test_locale = options[:locale] else options = {} end test_locale ||= I18n.locale inflector = I18n.backend.inflector # return immediately if the locale is not supported return super unless inflector.inflected_locale?(test_locale) # collect inflection variables that are present in this context subopts = t_prepare_inflection_options(inflector, locale, options) # jump to translate if no inflection options are present return super if subopts.empty? # pass options and call translate args.pop if opts_present args.push subopts.merge(options) super end # workaround for Ruby 1.8.x bug if RUBY_VERSION.gsub(/\D/,'')[0..1].to_i < 19 def t(*args); translate(*args) end else alias_method :t, :translate end protected # This method tries to read +i18n_inflector_kinds+ available in the current context. # # @return [Hash] the inflection options (kind => value) def t_prepare_inflection_options(inflector, locale, options) subopts = {} verifies = options[:inflector_verify_methods] verifies = inflector.options.verify_methods if verifies.nil? is_lazy = options[:inflector_lazy_methods] is_lazy = inflector.options.lazy_methods if is_lazy.nil? return subopts if (verifies && !respond_to?(:i18n_inflector_kinds)) i18n_inflector_kinds.each_pair do |kind, meth| next if meth.nil? # kind is registered but disabled from usage next if verifies && !respond_to?(meth) obj = method(meth) obj = obj.call { next kind, locale } unless is_lazy # lazy_methods is disabled subopts[kind] = obj end return subopts end end # module InflectedTranslate end # module Rails end # module Inflector end # module I18n ruby-i18n-inflector-rails-1.0.6/lib/i18n-inflector-rails/options.rb000066400000000000000000000076371214772653600250410ustar00rootroot00000000000000# encoding: utf-8 # # Author:: Paweł Wilk (mailto:pw@gnu.org) # Copyright:: (c) 2011 by Paweł Wilk # License:: This program is licensed under the terms of {file:LGPL-LICENSE GNU Lesser General Public License} or {file:COPYING Ruby License}. # # This file contains I18n::Inflector::Rails::AdditionalOptions module, # which extends I18n::Inflector::InflectionOptions so new switches controlling # inflector's behavior are available. module I18n module Inflector # This module adds options to {I18n::Inflector::InflectionOptions} class InflectionOptions # When this is set to +true+ then # inflection works a bit slower but # checks whether any method exists before # calling it. # # This switch is by default set # to +false+. # # By turning this switch on you're sure that # there will be no +NameError+ (no method) exception # raised during translation. # # Alternatively you can turn this on locally, # for the specified translation call, by setting # :inflector_verify_methods option to +true+. # # @example Globally enabling methods verification # I18n.inflector.options.verify_methods = true # @example Locally enabling methods verification # translate('welcome', :inflector_verify_methods => true) attr_accessor :verify_methods # When this is set to +true+ then # each time infleciton method is registered # it becomes a helper method so it's available in # a view. # # This switch is by default set # to +true+. # # Setting this switch locally, # for the specified translation call, using # :inflector_auto_helper option will # have no effect. # # @example Globally disabling automatic setting of helpers # I18n.inflector.options.auto_helper = false attr_accessor :auto_helper # When this is set to +true+ then # each time an infleciton method is used to obtain # value for the associated kind it evaluates lazy. # That means the method object is passed to the # translation routines and it is evaluated when there # is a need. If this is set to +false+ then # evaluation takes place before calling Inflector's # translation method and inflection options are passed # as symbols, not as method objects. # # This switch is by default set # to +true+. By disabling it you may experience # some negative performance impact when many # inflection methods are registered. That is because # the lazy evaluation causes calling only those methods # that are needed by internal interpolation routines # of the Inflector. For instance, if in some pattern # only the kind "gender" is used then there is no # need to call inflection methods for other kinds. # When lazy evaluation is disabled then all inflection # methods have to be called before passing control # to translation routines, since this plug-in does not # analyze contents of inflection patterns or keys. # # Alternatively you can turn this off locally, # for the specified translation call, by setting # :inflector_lazy_methods option to +false+. # # @example Globally disabling lazy evaluation of kinds # I18n.inflector.options.lazy_methods = false # @example Locally disabling lazy evaluation of kinds # translate('welcome', :inflector_lazy_methods => false) attr_accessor :lazy_methods # @private alias_method :_rai_orig_reset, :reset # This method resets inflector's # switches to default values. def reset @verify_methods = false @auto_helper = true @lazy_methods = true _rai_orig_reset end end # class InflectionOptions end # module Inflector end # module I18n ruby-i18n-inflector-rails-1.0.6/lib/i18n-inflector-rails/railtie.rb000066400000000000000000000014341214772653600247640ustar00rootroot00000000000000# encoding: utf-8 # # Author:: Paweł Wilk (mailto:pw@gnu.org) # Copyright:: (c) 2011 by Paweł Wilk # License:: This program is licensed under the terms of {file:LGPL-LICENSE GNU Lesser General Public License} or {file:COPYING Ruby License}. # # This file loads I18n::Inflector::Rails goodies into Rails. module I18n module Inflector module Rails class Railtie < ::Rails::Engine initializer :before_initialize do ActionController::Base.send(:extend, I18n::Inflector::Rails::ClassMethods) ActionController::Base.send(:include, I18n::Inflector::Rails::InstanceMethods) end initializer :after_initialize do ActionController::Base.helper I18n::Inflector::Rails::InflectedTranslate end end end end end ruby-i18n-inflector-rails-1.0.6/lib/i18n-inflector-rails/version.rb000066400000000000000000000015031214772653600250150ustar00rootroot00000000000000# encoding: utf-8 # # Author:: Paweł Wilk (mailto:pw@gnu.org) # Copyright:: (c) 2011 by Paweł Wilk # License:: This program is licensed under the terms of {file:LGPL-LICENSE GNU Lesser General Public License} or {file:COPYING Ruby License}. # # This file contains version information. module I18n module Inflector module Rails # @private DEVELOPER = 'Paweł Wilk' # @private EMAIL = 'pw@gnu.org' # @private VERSION = '1.0.6' # @private NAME = 'i18n-inflector-rails' # @private SUMMARY = 'I18n Inflector bindings for Rails' # @private URL = 'https://rubygems.org/gems/i18n-inflector-rails/' # @private DESCRIPTION = 'Plug-in that provides I18n Inflector module integration with Rails.' end end end ruby-i18n-inflector-rails-1.0.6/metadata.gz.sig000066400000000000000000000004001214772653600212610ustar00rootroot00000000000000 eCnbS~93Z,1_SX? (VOaRa#*rcYW#%I*K=۲$Ëv'>&9/=#~]XGCrj+=F^U6' 0b fg`D%c K૘5^eX&+|4b\m l]~߆`Rc3苅}Xóoo٪:uruby-i18n-inflector-rails-1.0.6/metadata.yml000066400000000000000000000130301214772653600206640ustar00rootroot00000000000000--- !ruby/object:Gem::Specification name: i18n-inflector-rails version: !ruby/object:Gem::Version prerelease: version: 1.0.6 platform: ruby authors: - "Pawe\xC5\x82 Wilk" autorequire: bindir: bin cert_chain: - | -----BEGIN CERTIFICATE----- MIIDKjCCAhKgAwIBAgIBADANBgkqhkiG9w0BAQUFADA7MQ8wDQYDVQQDDAZzaWVm Y2ExEzARBgoJkiaJk/IsZAEZFgNnbnUxEzARBgoJkiaJk/IsZAEZFgNvcmcwHhcN MDkwNjA2MDkwODA5WhcNMTAwNjA2MDkwODA5WjA7MQ8wDQYDVQQDDAZzaWVmY2Ex EzARBgoJkiaJk/IsZAEZFgNnbnUxEzARBgoJkiaJk/IsZAEZFgNvcmcwggEiMA0G CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCdk4+9ieSx2I2OPslPcj/LjajwtsrH mev6Fs3xK9hdDIbbLuQM9AypBS7NeKP/2YToEOGxsvzcpFzL2Ah71cP6Yfn+Z2Yo zvqpAx5/nl79PrJKvjlkdzVNOFBp/EOkLK67QK4Pv97ABnG2PkF4FokqOjuNHLM7 47OkJPvFyfHyMBDZN7EFljBBNm3IuQRTiO48e5Jcp3L761PWOvCpnV8wiga0Wwt3 98Gmy7c1nWzfbQc1wHwKLPICY/aidKU20KymSHG63BSW5pO2cXZecIeYjw5YNjGA M1RZMiwT7QJ9W86VVP+8EqbJKJOS95xlmQTHjPK56yXv8GiuyLQHpPh5AgMBAAGj OTA3MAkGA1UdEwQCMAAwHQYDVR0OBBYEFKOKspZONq4bt5D2DEexB+vsMB2GMAsG A1UdDwQEAwIEsDANBgkqhkiG9w0BAQUFAAOCAQEAUh0LnB4o5XKpH3yOxavEyp9X Nen2e854wsSjAr0waSVzEt3XxY1voyIE6WCGxZJU//40CR0Be7j5CcsJsDU2CZyZ 8SXN1/mZjMqWvYyEMSfQP4XzkFSOuyDcoDAf43OGhOhdv5Jcs/Et/FH6DgWYwRxq RtATRWON5R99ugPeRb7i1nIpnzGEBA9V32r6r959Bp3XjkVEXylbItYMqSARaZlY qzKSsIUjh7vDyTNqta0DjSgCk26dhnOwc0hmzhvVZtBwfZritSVhfCLp5uFwqCqY NK3TIZaPCh1S2/ES6wXNvjQ+5EnEEL9j/pSEop9DYEBPaM2WDVR5i0jJTAaRWw== -----END CERTIFICATE----- date: 2011-08-09 00:00:00 Z dependencies: - !ruby/object:Gem::Dependency name: i18n-inflector requirement: &id001 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: "2.6" type: :runtime prerelease: false version_requirements: *id001 - !ruby/object:Gem::Dependency name: railties requirement: &id002 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: "3.0" type: :runtime prerelease: false version_requirements: *id002 - !ruby/object:Gem::Dependency name: actionpack requirement: &id003 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: "3.0" type: :runtime prerelease: false version_requirements: *id003 - !ruby/object:Gem::Dependency name: hoe-yard requirement: &id004 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version version: 0.1.2 type: :development prerelease: false version_requirements: *id004 - !ruby/object:Gem::Dependency name: rspec requirement: &id005 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version version: 2.6.0 type: :development prerelease: false version_requirements: *id005 - !ruby/object:Gem::Dependency name: yard requirement: &id006 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version version: 0.7.2 type: :development prerelease: false version_requirements: *id006 - !ruby/object:Gem::Dependency name: rdoc requirement: &id007 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version version: 3.8.0 type: :development prerelease: false version_requirements: *id007 - !ruby/object:Gem::Dependency name: bundler requirement: &id008 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version version: 1.0.10 type: :development prerelease: false version_requirements: *id008 - !ruby/object:Gem::Dependency name: hoe-bundler requirement: &id009 !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version version: 1.1.0 type: :development prerelease: false version_requirements: *id009 - !ruby/object:Gem::Dependency name: hoe requirement: &id010 !ruby/object:Gem::Requirement none: false requirements: - - ~> - !ruby/object:Gem::Version version: "2.10" type: :development prerelease: false version_requirements: *id010 description: Plug-in that provides I18n Inflector module integration with Rails. email: - pw@gnu.org executables: [] extensions: [] extra_rdoc_files: - Manifest.txt files: - .rspec - .yardopts - ChangeLog - Gemfile - LGPL-LICENSE - Manifest.txt - README.rdoc - Rakefile - docs/COPYING - docs/HISTORY - docs/LEGAL - docs/LGPL-LICENSE - docs/TODO - docs/rdoc.css - i18n-inflector-rails.gemspec - init.rb - lib/i18n-inflector-rails.rb - lib/i18n-inflector-rails/errors.rb - lib/i18n-inflector-rails/inflector.rb - lib/i18n-inflector-rails/options.rb - lib/i18n-inflector-rails/railtie.rb - lib/i18n-inflector-rails/version.rb - spec/inflector_spec.rb - spec/spec_helper.rb - .gemtest homepage: https://rubygems.org/gems/i18n-inflector-rails/ licenses: [] post_install_message: rdoc_options: - --title - I18n::Inflector::Rails Documentation - --quiet require_paths: - lib required_ruby_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version hash: -4022217839564024347 segments: - 0 version: "0" required_rubygems_version: !ruby/object:Gem::Requirement none: false requirements: - - ">=" - !ruby/object:Gem::Version version: "0" requirements: [] rubyforge_project: i18n-inflector-rails rubygems_version: 1.8.5 signing_key: specification_version: 3 summary: I18n Inflector bindings for Rails test_files: [] ruby-i18n-inflector-rails-1.0.6/spec/000077500000000000000000000000001214772653600173165ustar00rootroot00000000000000ruby-i18n-inflector-rails-1.0.6/spec/inflector_spec.rb000066400000000000000000000330771214772653600226540ustar00rootroot00000000000000require 'spec_helper' class ApplicationController < ActionController::Base; end class InflectedTranslateController < ApplicationController; end class InflectedStrictController < ApplicationController; end describe I18n.inflector.options.class do context "instance I18n.inflector.options" do it "should contain verify_methods switch" do I18n.inflector.options.should respond_to :verify_methods end it "should have default value set to false" do I18n.inflector.options.verify_methods.should == false end end end describe ApplicationController do before do I18n.locale = :xx I18n.backend.store_translations(:xx, :i18n => { :inflections => { :gender => { :m => 'male', :f => 'female', :n => 'neuter', :s => 'strange', :masculine => '@m', :feminine => '@f', :neuter => '@n', :neutral => '@neuter', :default => 'neutral' }, :time => { :present => 'present', :past => 'past', :future => 'future'}, :@gender => { :m => 'male', :f => 'female', :d => 'dude', :x => 'tester', :n => 'neuter', :default => 'n'}, :person => { :i => 'I', :you => 'You', :it => 'It'}, :@person => { :i => 'I', :you => 'You', :it => 'It'}, } }) I18n.backend.store_translations(:ns, 'welcome' => 'Dear @{f:Lady|m:Sir|n:You|All}!') I18n.backend.store_translations(:xx, 'welcome' => 'Dear @{f:Lady|m:Sir|n:You|All}!') I18n.backend.store_translations(:xx, 'welcome_strict' => 'Dear @gender{f:Lady|m:Sir|d:Dude|n:You|All}!') I18n.backend.store_translations(:xx, 'to_be' => 'Oh @{i:I am|you:You are|it:It is}') I18n.backend.store_translations(:xx, 'to_be_strict' => 'Oh @person{i:me|you:You are|it:It is}') I18n.backend.store_translations(:xx, 'hitime' => '@{present,past,future:~}!') end describe ".inflection_method" do before do class AnotherController < InflectedTranslateController; end end it "should be albe to assign a mehtod to the inflection kind" do lambda{AnotherController.inflection_method(:users_gender => :gender)}.should_not raise_error end it "should be albe to assign a mehtod to the strict inflection kind" do lambda{AnotherController.inflection_method(:users_gender => :@gender)}.should_not raise_error end it "should be albe to accept single Symbol argument" do lambda{AnotherController.inflection_method(:time)}.should_not raise_error lambda{AnotherController.inflection_method(:@time)}.should_not raise_error end it "should be albe to accept single String argument" do lambda{AnotherController.inflection_method('time')}.should_not raise_error lambda{AnotherController.inflection_method('@time')}.should_not raise_error end it "should be albe to accept Array argument" do lambda{AnotherController.inflection_method([:time])}.should_not raise_error lambda{AnotherController.inflection_method([:@time])}.should_not raise_error end it "should raise an error when method name is wrong" do lambda{AnotherController.inflection_method}.should raise_error lambda{AnotherController.inflection_method(nil => :blabla)}.should raise_error lambda{AnotherController.inflection_method(:blabla => nil)}.should raise_error lambda{AnotherController.inflection_method(nil => :@blabla)}.should raise_error lambda{AnotherController.inflection_method(:@blabla => nil)}.should raise_error lambda{AnotherController.inflection_method(:"@")}.should raise_error lambda{AnotherController.inflection_method({''=>''})}.should raise_error lambda{AnotherController.inflection_method(nil => nil)}.should raise_error lambda{AnotherController.inflection_method(nil)}.should raise_error lambda{AnotherController.inflection_method([nil])}.should raise_error lambda{AnotherController.inflection_method([''])}.should raise_error lambda{AnotherController.inflection_method([])}.should raise_error lambda{AnotherController.inflection_method({})}.should raise_error end end describe ".no_inflection_method" do before do class AnotherController < InflectedTranslateController; end end it "should be albe to split a mehtod of the inflection kind" do lambda{AnotherController.no_inflection_method(:users_gender)}.should_not raise_error end it "should be albe to accept single Symbol argument" do lambda{AnotherController.no_inflection_method(:time)}.should_not raise_error lambda{AnotherController.no_inflection_method(:@time)}.should_not raise_error end it "should be albe to accept single String argument" do lambda{AnotherController.no_inflection_method('time')}.should_not raise_error lambda{AnotherController.no_inflection_method('@time')}.should_not raise_error end it "should be albe to accept Array argument" do lambda{AnotherController.no_inflection_method([:time])}.should_not raise_error lambda{AnotherController.no_inflection_method([:@time])}.should_not raise_error end it "should raise an error when method name is wrong" do lambda{AnotherController.no_inflection_method}.should raise_error lambda{AnotherController.no_inflection_method(nil)}.should raise_error lambda{AnotherController.no_inflection_method([nil])}.should raise_error lambda{AnotherController.no_inflection_method(:"@")}.should raise_error lambda{AnotherController.no_inflection_method([''])}.should raise_error lambda{AnotherController.no_inflection_method([])}.should raise_error lambda{AnotherController.no_inflection_method({})}.should raise_error end end describe ".no_inflection_kind" do before do class AnotherController < InflectedTranslateController; end end it "should be albe to spit a mehtod of the inflection kind" do lambda{AnotherController.no_inflection_kind(:gender)}.should_not raise_error lambda{AnotherController.no_inflection_kind(:@gender)}.should_not raise_error end it "should be albe to accept single Symbol argument" do lambda{AnotherController.no_inflection_kind(:time)}.should_not raise_error lambda{AnotherController.no_inflection_kind(:@time)}.should_not raise_error end it "should be albe to accept single String argument" do lambda{AnotherController.no_inflection_kind('time')}.should_not raise_error lambda{AnotherController.no_inflection_kind('@time')}.should_not raise_error end it "should be albe to accept Array argument" do lambda{AnotherController.no_inflection_kind([:time])}.should_not raise_error lambda{AnotherController.no_inflection_kind([:@time])}.should_not raise_error end it "should raise an error when method name is wrong" do lambda{AnotherController.no_inflection_kind}.should raise_error lambda{AnotherController.no_inflection_kind(nil)}.should raise_error lambda{AnotherController.no_inflection_kind(:"@")}.should raise_error lambda{AnotherController.no_inflection_kind([nil])}.should raise_error lambda{AnotherController.no_inflection_kind([''])}.should raise_error lambda{AnotherController.no_inflection_kind([])}.should raise_error lambda{AnotherController.no_inflection_kind({})}.should raise_error end end describe ".i18n_inflector_kinds" do before do InflectedTranslateController.inflection_method(:users_gender => :gender) InflectedTranslateController.inflection_method(:time) @expected_hash = { :gender => :users_gender, :time => :time } end it "should be callable" do lambda{InflectedTranslateController.i18n_inflector_kinds}.should_not raise_error end it "should be able to read methods assigned to inflection kinds" do InflectedTranslateController.i18n_inflector_kinds.should == @expected_hash end end describe "controller instance methods" do before do class InflectedTranslateController def trn(*args); t(*args) end def t_male; t('welcome') end def users_gender; :m end def time kind, locale = yield kind == :time ? :past : nil end end class InflectedStrictController inflection_method :@gender def gender; :m end def trn(*args); translate(*args) end end class InflectedStrictOverrideController < InflectedTranslateController inflection_method :users_dude => :@gender inflection_method :users_female => :gender inflection_method :person_i => :person no_inflection_method_for :@person def users_female; :f end def users_dude; :d end def person_i; :i end end class NomethodController < InflectedTranslateController inflection_method :nonexistent => :gender end class MethodDisabledController < InflectedTranslateController no_inflection_method :users_gender end @controller = InflectedTranslateController.new @strict_controller = InflectedStrictController.new @strict_over_controller = InflectedStrictOverrideController.new @disabled_controller = MethodDisabledController.new @nomethod_controller = NomethodController.new end describe "#i18n_inflector_kinds" do before do @expected_hash = {:gender => :users_gender, :time => :time } end it "should be able to read methods assigned to inflection kinds" do @controller.i18n_inflector_kinds.should == @expected_hash end end describe "#translate" do it "should translate using inflection patterns and pick up the right value" do @controller.trn('welcome').should == 'Dear Sir!' @controller.trn('welcome_strict').should == 'Dear Sir!' @strict_controller.trn('welcome_strict').should == 'Dear Sir!' end it "should make use of a block passed to inflection method" do @controller.trn('hitime').should == 'past!' end it "should make use of inherited inflection method assignments" do @strict_over_controller.trn('hitime').should == 'past!' end it "should make use of overriden inflection method assignments" do @strict_over_controller.trn('welcome').should == 'Dear Lady!' end it "should prioritize strict kinds when both inflection options are passed" do @strict_over_controller.trn('welcome_strict').should == 'Dear Dude!' @strict_over_controller.trn('welcome').should == 'Dear Lady!' end it "should use regular kind option when strict kind option is missing" do @strict_over_controller.trn('to_be').should == 'Oh I am' @strict_over_controller.trn('to_be_strict').should == 'Oh me' end it "should make use of disabled inflection method assignments" do @disabled_controller.trn('welcome').should == 'Dear You!' end it "should raise exception when method does not exists" do lambda{@nomethod_controller.translated_male}.should raise_error(NameError) end it "should not raise when method does not exists and verify_methods is enabled" do lambda{@nomethod_controller.trn('welcome', :inflector_verify_methods => true)}.should_not raise_error(NameError) I18n.inflector.options.verify_methods = true lambda{@nomethod_controller.trn('welcome')}.should_not raise_error(NameError) end it "should translate with the :inflector_lazy_methods switch turned off" do @strict_over_controller.trn('welcome', :inflector_lazy_methods => false).should == 'Dear Lady!' end it "should omit pattern interpolation when locale is not inflected" do @strict_over_controller.trn('welcome', :locale => :ns).should == 'Dear !' end end describe "#t" do it "should call translate" do @controller.t_male.should == 'Dear Sir!' end end end end ruby-i18n-inflector-rails-1.0.6/spec/spec_helper.rb000066400000000000000000000000641214772653600221340ustar00rootroot00000000000000require 'rspec/core' require 'i18n-inflector-rails'