]> git.openstreetmap.org Git - rails.git/blobdiff - vendor/plugins/i18n_data/lib/i18n_data.rb
Added localized language names with plugin from http://github.com/grosser/i18n_data...
[rails.git] / vendor / plugins / i18n_data / lib / i18n_data.rb
diff --git a/vendor/plugins/i18n_data/lib/i18n_data.rb b/vendor/plugins/i18n_data/lib/i18n_data.rb
new file mode 100644 (file)
index 0000000..9f6cb52
--- /dev/null
@@ -0,0 +1,31 @@
+require 'activesupport'
+module I18nData
+  extend self
+  
+  def languages(language_code='EN')
+    data_provider.codes(:languages,language_code.to_s.upcase)
+  end
+
+  def countries(language_code='EN')
+    data_provider.codes(:countries,language_code.to_s.upcase)
+  end
+
+  def data_provider
+    if @data_provider
+      @data_provider
+    else
+      require 'i18n_data/file_data_provider'
+      FileDataProvider
+    end
+  end
+
+  def data_provider=(provider)
+    @data_provider = provider
+  end
+  
+  class NoTranslationAvailable < Exception
+    def to_s
+      "NoTranslationAvailable -- #{super}"
+    end
+  end
+end
\ No newline at end of file