]> source.dussan.org Git - redmine.git/commitdiff
git-svn-id: http://redmine.rubyforge.org/svn/trunk@13 e93f8b46-1217-0410-a6f0-8f06a73...
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Jul 2006 19:53:34 +0000 (19:53 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sat, 29 Jul 2006 19:53:34 +0000 (19:53 +0000)
redmine/vendor/plugins/localization/README [deleted file]
redmine/vendor/plugins/localization/init.rb [deleted file]
redmine/vendor/plugins/localization/lib/localization.rb [deleted file]

diff --git a/redmine/vendor/plugins/localization/README b/redmine/vendor/plugins/localization/README
deleted file mode 100644 (file)
index 0996906..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-= Localization Plugin for Rails\r
-\r
-This plugin provides a simple, gettext-like method to\r
-provide localizations.\r
-\r
-== Features\r
-\r
- * Any number of languages or locales\r
- * Simple method to defines singluar/plural translations\r
- * Can use lambdas to provide Ruby-code based dynamic translations\r
- * Customizable for different instances of the application\r
-\r
-== Usage\r
-\r
-If the localization plugin is installed, it is used automatically.\r
-\r
-You need to create a /lang dir in your RAILS_ROOT.\r
-\r
-The recommended way to use it is to create files that are named\r
-like the languages you define in them (but you can put everything in\r
-one big file too.)\r
-\r
-For instance-customizable strings, add overrides in files you\r
-put in /lang/custom.\r
-\r
-=== Simple example:\r
-\r
-Create a file /lang/translations.rb:\r
-  \r
-  Localization.define('de') do |l|\r
-    l.store 'yes', 'Ja'\r
-    l.store 'no', 'Nein'\r
-  end\r
-  \r
-  Localization.define('fr') do |l|\r
-    l.store 'yes', 'oui'\r
-    l.store 'no', 'non'\r
-  end\r
-  \r
-In your controller or application.rb:\r
-\r
-  Localization.lang = 'de' # or 'fr'\r
-  \r
-In your view:\r
-\r
-  <%=_ 'yes' %>\r
-  <%=_ 'no' %>\r
-  \r
-Because the _ method is simply an extension to Object, you\r
-can use it anywhere (models/controllers/views/libs).\r
-  \r
-=== Extended example:\r
-\r
-Create a file /lang/default.rb with following contents:\r
-  \r
-  Localization.define do |l|\r
-    l.store '(time)', lambda { |t| t.strftime('%I:%M%p') }\r
-  end\r
-\r
-Create a file /lang/de_DE.rb with following contents:\r
-  \r
-  Localization.define('de_DE') do |l|\r
-    l.store '%d entries', ['Ein Eintrag', '%d Einträge']\r
-    l.store '(time)', lambda { |t| t.strftime('%H:%M') }\r
-  end\r
-  \r
-In your controller or application.rb:\r
-  \r
-  Localization.lang = 'de_DE'\r
-\r
-In your view:\r
-\r
-  <%=_ '%d entries', 1 %>     # singular variant is chosen \r
-  <%=_ '%d entries', 4 %>     # plural variant is chosen\r
-  <%=_ '(time)', Time.now %>  # call the block with a parameter\r
-  \r
-== Translation file guesstimation\r
-\r
-You can generate a guesstimation of all strings needed to be\r
-translated in your views by first adding the _('blah') syntax\r
-everywhere and then calling:\r
-\r
-  puts Localization.generate_l10n_file\r
-  \r
-in the Rails console.
\ No newline at end of file
diff --git a/redmine/vendor/plugins/localization/init.rb b/redmine/vendor/plugins/localization/init.rb
deleted file mode 100644 (file)
index 72ed7b9..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-require "#{directory}/lib/localization.rb"
-
-Localization.load
\ No newline at end of file
diff --git a/redmine/vendor/plugins/localization/lib/localization.rb b/redmine/vendor/plugins/localization/lib/localization.rb
deleted file mode 100644 (file)
index d1756b1..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# Original Localization plugin for Rails can be found at:\r
-# http://mir.aculo.us/articles/2005/10/03/ruby-on-rails-i18n-revisited\r
-#\r
-# Slightly edited by Jean-Philippe Lang\r
-# - added @@langs and modified self.define method to maintain an array of available \r
-#   langages with labels, eg. { 'en' => 'English, 'fr' => 'French }\r
-# - modified self.generate_l10n_file method to retrieve already translated strings\r
-#\r
-\r
-module Localization
-  mattr_accessor :lang, :langs
-  
-  @@l10s = { :default => {} }
-  @@lang = :default\r
-  @@langs = {}\r
-  
-  def self._(string_to_localize, *args)
-    translated = @@l10s[@@lang][string_to_localize] || string_to_localize
-    return translated.call(*args).to_s  if translated.is_a? Proc
-    if translated.is_a? Array
-      translated = if translated.size == 3 
-        translated[args[0]==0 ? 0 : (args[0]>1 ? 2 : 1)]
-      else
-        translated[args[0]>1 ? 1 : 0]
-      end
-    end
-    sprintf translated, *args
-  end
-  
-  def self.define(lang = :default, name = :default)
-    @@l10s[lang] ||= {}\r
-    @@langs[lang] = [ name ]\r
-    yield @@l10s[lang]
-  end\r
-  
-  def self.load
-    Dir.glob("#{RAILS_ROOT}/lang/*.rb"){ |t| require t }
-    Dir.glob("#{RAILS_ROOT}/lang/custom/*.rb"){ |t| require t }
-  end
-  
-  # Generates a best-estimate l10n file from all views by
-  # collecting calls to _() -- note: use the generated file only
-  # as a start (this method is only guesstimating)
-  def self.generate_l10n_file(lang)
-    "Localization.define('en_US') do |l|\n" <<
-    Dir.glob("#{RAILS_ROOT}/app/views/**/*.rhtml").collect do |f| 
-      ["# #{f}"] << File.read(f).scan(/<%.*[^\w]_\s*[\(]+[\"\'](.*?)[\"\'][\)]+/)
-    end.uniq.flatten.collect do |g|
-      g.starts_with?('#') ? "\n  #{g}" : "  l.store '#{g}', '#{@@l10s[lang][g]}'"
-    end.uniq.join("\n") << "\nend"
-  end
-  
-end
-
-class Object
-  def _(*args); Localization._(*args); end
-end
\ No newline at end of file