<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -1,10 +1,10 @@
 Merb_babel
 =========
 
-A plugin for the Merb framework that provides locales, languages, countries. (multi threaded)
+A plugin for the Merb framework that provides locales, languages, countries. (in a thread safe environment)
 
 
-Purpose of Merb_babel
+Purpose of Merb\_babel
 ---------------------
 
 Merb_babel is primarily written to fulfill my personal needs. Instead of porting my http://github.com/mattetti/globalite plugin over, I decided to re write it from scratch learning from my mistakes.
@@ -18,7 +18,7 @@ My first and simple objective is to get Merb to work in Simplified and Tradition
 
 Also, as of today, I'm not planning on supporting model localization since I believe it's easy to do, and in most cases it's too specific to use a plugin. (but other plugins offer that for you anyway ;) )
 
-One of the objectives is that people can require Merb_babel and use merb in a different language without worrying about internationalization/localization. I hope to keep merb helpers and other plugins (merb_activerecord / merb_datamapper) localized so someone can define his app's locale/language/country and Merb will talk his language right away.
+One of the objectives is that people can add Merb\_babel to their project and use merb in a different language without worrying about internationalization/localization. I hope to keep merb helpers and other plugins (merb\_activerecord / merb\_datamapper / merb\_sequel) localized so someone can define his app's locale/language/country and Merb will talk his language right away.
 
 Before you go further, you might want to read [this explanation about i18n/l10n](http://www.w3.org/International/questions/qa-i18n)
 
@@ -49,7 +49,7 @@ At the moment you have 3 ways of setting up a locale:
 * store the locale in the session
 * use routes
 
-Abel doesn't support http header lookup yet.
+Babel doesn't support http header lookup yet.
 
 Set locale in your routes
 --------------------------
@@ -66,20 +66,21 @@ some people might not need to use the full locale, they just want to use one ver
     before :set_language
     
     
-All locale work is done in merb_babel/lib/merb_babel/m_locale.rb and tested in spec/merb_babel_spec.rb
+All locale work is done in ``merb_babel/lib/merb_babel/m_locale.rb`` and tested in ``spec/merb_babel_spec.rb``
 
 Localization(L10n)
 ------------------
 
 L10n is basically the adaptation of your product to a specific locale. In our case, we see L10n as the storing and retrieval of localized data. (for a locale or language)
 
-Localizations are loaded from the localization files.
+Localizations are loaded from localization files.
 
-Localization files are simple yaml files that get loaded in memory. By default Merb_babel will look in ./lang for localization files. The default location is defined in Merb::Plugins.config[:merb_babel][:localization_dirs] and can be overwritten. Also, you can add more folders to look for by calling:
+Localization files are simple yaml files that get loaded in memory. By default Merb\_babel will look in ./lang for localization files. The default location is defined in Merb::Plugins.config[:merb_babel][:localization_dirs] and can be overwritten. Also, you can add more folders to look for by calling:
 
     add_localization_dir(path_with_more_localization_files)
     
 Note: when you add a new localization directory, localizations gets reloaded.
+This needs to be done when Merb loads as I didn't add a mutex around that task yet.
 
 Localizations are available in #localizations and are namespaced as follows:
 
@@ -91,7 +92,7 @@ Localizations are available in #localizations and are namespaced as follows:
 For that the localization files to be loaded properly, you need to follow some conventions:
 
 * you have to declare a merb localization language code pair: 
-    mloc_language_code: en
+    mloc\_language_code: en
 where en represents the language code of the localization
 
 * All generic localization for a language should go under their own language file. Region/culture specific localizations have to go to their own files and will be used if the full locale is set.
@@ -100,11 +101,11 @@ where en represents the language code of the localization
 
 * ONLY localizations/translations specific to a locale should be written in a locale file.
 
-* Recommended: set the mloc_language_name pair so you list the available languages in their own language.
+* Recommended: set the mloc\_language_name pair so you list the available languages in their own language.
 
 * look at examples in spec/lang
 
-All the Localization(L10n) work is done in merb_babel/lib/merb_abel/m_l10n.rb and tested in spec/m_l10n_spec.rb
+All the Localization(L10n) work is done in ``merb_babel/lib/merb_abel/m_l10n.rb`` and tested in ``spec/m_l10n_spec.rb``
 
 
 Internationalization(I18n)
@@ -143,7 +144,6 @@ You can also pass the country code to use the full locale.
 would lookup the Australian English translation for the greetings key and return &quot;G'day&quot;
 
 
-
 Other plugins you might want to look at:
 ----------------------------------------
 </diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -26,7 +26,7 @@ spec = Gem::Specification.new do |s|
   s.add_dependency('merb-core', '~&gt; 1.0.0')
   s.require_path = 'lib'
   s.autorequire = PLUGIN
-  s.files = %w(LICENSE README Rakefile TODO) + Dir.glob(&quot;{lib,spec}/**/*&quot;)
+  s.files = %w(LICENSE README.markdown Rakefile TODO) + Dir.glob(&quot;{lib,spec}/**/*&quot;)
 end
 
 Rake::GemPackageTask.new(spec) do |pkg|
@@ -49,7 +49,7 @@ namespace :jruby do
 
   desc &quot;Run :package and install the resulting .gem with jruby&quot;
   task :install =&gt; :package do
-    sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{Merb::VERSION}.gem --no-rdoc --no-ri}
+    sh %{#{SUDO} jruby -S gem install pkg/#{NAME}-#{VERSION}.gem --no-rdoc --no-ri}
   end
   
 end</diff>
      <filename>Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ if defined?(Merb::Plugins)
   Merb::Plugins.config[:merb_babel] = {
     :default_locale =&gt; 'en-US',
     :default_language =&gt; 'en',
-    :default_country =&gt; 'US',
+    # :default_country =&gt; 'US',
     :localization_dirs =&gt; [&quot;#{Merb.root}/lang&quot;]
   }
   
@@ -19,7 +19,6 @@ if defined?(Merb::Plugins)
     # require code that must be loaded before the application
     module Merb
       module GlobalHelpers
-        include ML10n
 
         # Used to translate words using localizations
         def babelize(key, *args)
@@ -38,7 +37,7 @@ if defined?(Merb::Plugins)
     end
     
     Merb::Controller.send(:include, MLocale)
-    Merb::Controller.send(:include, ML10n)
+    ML10n.load_localization!
   end
   
   Merb::BootLoader.after_app_loads do</diff>
      <filename>lib/merb_babel.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,118 +1,118 @@
 module ML10n
   
-  # TODO add a mutex for when we load the localizations, in case people want to load the localizations
-  # during runtime
-  
-  def self.localizations
-    @@localizations ||= {}
-  end
-  
-  # all localizations are saved in this class variable
-  # localizations are namespaced using the language or locale they belong to
-  #
-  # for instance:
-  #   localizations['en'][:right] =&gt; 'right'
-  #   localizations['en'][:left] =&gt; 'left'
-  #   localizations['en']['US'][:greeting] =&gt; 'Howdie'
-  #   localizations['en']['AU'][:greeting] =&gt; &quot;Good'ay&quot;
-  # 
-  # locales, including languages and countries use string keys while localization keys themselves are symbols
-  def localizations
-    ML10n.localizations
-  end
+  class &lt;&lt; self
+  
+    # TODO add a mutex for when we load the localizations, in case people want to load the localizations
+    # at runtime
+
+    # all localizations are saved in this class variable
+    # localizations are namespaced using the language or locale they belong to
+    #
+    # for instance:
+    #   ML10n.localizations['en'][:right] =&gt; 'right'
+    #   ML10n.localizations['en'][:left] =&gt; 'left'
+    #   ML10n.localizations['en']['US'][:greeting] =&gt; 'Howdie'
+    #   ML10n.localizations['en']['AU'][:greeting] =&gt; &quot;Good'ay&quot;
+    # 
+    # locales, including languages and countries use string keys while localization keys themselves are symbols  
+    def localizations
+      @@localizations ||= {}
+    end
   
-  # files containing localizations
-  def localization_files
-    @@localization_files ||= find_localization_files
-  end
+    # files containing localizations
+    def localization_files
+      @@localization_files ||= ML10n.find_localization_files
+    end
   
-  # locations to look for localization files
-  def localization_dirs
-    @@localization_dirs ||= Merb::Plugins.config[:merb_babel][:localization_dirs].dup
-  end
+    # locations to look for localization files
+    def localization_dirs
+      @@localization_dirs ||= Merb::Plugins.config[:merb_babel][:localization_dirs].dup
+    end
   
-  # add a dir to look for localizations
-  def add_localization_dir(dir_path)
-    return localization_dirs if dir_path.empty?
-    unless localization_dirs.include?(dir_path)
-      localization_dirs &lt;&lt; dir_path
-      reload_localization_files! 
+    # add a dir to look for localizations
+    def add_localization_dir(dir_path)
+      return ML10n.localization_dirs if dir_path.empty?
+      unless ML10n.localization_dirs.include?(dir_path)
+        ML10n.localization_dirs &lt;&lt; dir_path
+        ML10n.reload_localization_files! 
+      end
+      return ML10n.localization_dirs
     end
-    return localization_dirs
-  end
   
-  def load_localization!
+    def load_localization!
     
-    # look for localization files directly just in case new files were added
-    reset_localization_files! 
-    find_localization_files.each do |l_file|
-      begin
-        l_hash = YAML.load_file(l_file).symbolize_keys
-      rescue Exception =&gt; e
-        # might raise a real error here in the future
-        p e.inspect
-      else
-        load_localization_hash(l_hash)
+      # look for localization files directly just in case new files were added
+      ML10n.reset_localization_files! 
+      ML10n.find_localization_files.each do |l_file|
+        begin
+          l_hash = YAML.load_file(l_file).symbolize_keys
+        rescue Exception =&gt; e
+          # might raise a real error here in the future
+          p e.inspect
+        else
+          load_localization_hash(l_hash)
+        end
       end
-    end
     
-  end
+    end
   
-  # go through the localization dirs and find the localization files
-  def find_localization_files
-    l_files = []
-    localization_dirs.map do |l_dir|
-      Dir[&quot;#{l_dir}/*&quot;, '*.{yml,yaml}'].each do |file|
-        l_files &lt;&lt; file unless l_files.include?(file)
+    # go through the localization dirs and find the localization files
+    def find_localization_files
+      l_files = []
+      ML10n.localization_dirs.map do |l_dir|
+        Dir[&quot;#{l_dir}/*&quot;, '*.{yml,yaml}'].each do |file|
+          l_files &lt;&lt; file unless l_files.include?(file)
+        end
       end
+      return l_files
     end
-    return l_files
-  end
-  
-  # reset the localization dirs and files to the plugin config
-  # careful when using this method since it will remove any localization files
-  # you loaded after the plugin started
-  # 
-  # note that it won't clear the localization already loaded in memory
-  def reset_localization_files_and_dirs!
-    reset_localization_dirs!
-    reset_localization_files!
-  end
   
-  def reset_localization_dirs!
-    @@localization_dirs = nil
-  end
+    # reset the localization dirs and files to the plugin config
+    # careful when using this method since it will remove any localization files
+    # you loaded after the plugin started
+    # 
+    # note that it won't clear the localization already loaded in memory
+    def reset_localization_files_and_dirs!
+      ML10n.reset_localization_dirs!
+      ML10n.reset_localization_files!
+    end
   
-  def reset_localization_files!
-    @@localization_files = nil
-    find_localization_files
-  end
+    def reset_localization_dirs!
+      @@localization_dirs = nil
+    end
   
-  def reload_localization_files!
-    reset_localization_files!
-    find_localization_files
-  end
+    def reset_localization_files!
+      @@localization_files = nil
+      ML10n.find_localization_files
+    end
   
-  # localization helper
-  def self.localize(key, *options)
-    MI18n.localize(options.merge({:locale =&gt; locale}))
-  end
+    def reload_localization_files!
+      ML10n.reset_localization_files!
+      ML10n.find_localization_files
+    end
   
-  protected
+    # localization helper
+    def localize(key, *options)
+      MI18n.localize(options.merge({:locale =&gt; locale}))
+    end
   
-  def load_localization_hash(l_hash)
-    if l_hash.valid_localization_hash?
-      language = l_hash[:mloc_language_code]
-      if l_hash.localization_hash_with_locale?
-        country = l_hash[:mloc_country_code]
-        # load localization under the full locale namespace
-        localizations[language] ||= {}
-        (localizations[language][country] ||= {}).merge!(l_hash)
-      else
-        # load generic language localization
-        (localizations[language] ||= {}).merge!(l_hash)
+    protected
+  
+    def load_localization_hash(l_hash)
+      if l_hash.valid_localization_hash?
+        language = l_hash[:mloc_language_code]
+        if l_hash.localization_hash_with_locale?
+          country = l_hash[:mloc_country_code]
+          # load localization under the full locale namespace
+          ML10n.localizations[language] ||= {}
+          (ML10n.localizations[language][country] ||= {}).merge!(l_hash)
+        else
+          # load generic language localization
+          (ML10n.localizations[language] ||= {}).merge!(l_hash)
+        end
       end
     end
+    
   end
   
 end
\ No newline at end of file</diff>
      <filename>lib/merb_babel/m_l10n.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
-namespace :merb_babel do
-  desc &quot;Do something for merb_babel&quot;
-  task :default do
-    puts &quot;merb_babel doesn't do anything&quot;
-  end
-end
\ No newline at end of file
+# namespace :merb_babel do
+#   desc &quot;Do something for merb_babel&quot;
+#   task :default do
+#     puts &quot;merb_babel doesn't do anything&quot;
+#   end
+# end
\ No newline at end of file</diff>
      <filename>lib/merb_babel/merbtasks.rb</filename>
    </modified>
    <modified>
      <diff>@@ -5,9 +5,9 @@ describe '#babelize' do
   before(:each) do
     Merb::Controller.send :include, Merb::GlobalHelpers
     @c = dispatch_to(TestController, :index)
-    @c.add_localization_dir(File.expand_path(File.dirname(__FILE__) + &quot;/lang&quot;))
-    @c.add_localization_dir(File.expand_path(File.dirname(__FILE__) + &quot;/other_lang_dir&quot;))
-    @c.load_localization!
+    ML10n.add_localization_dir(File.expand_path(File.dirname(__FILE__) + &quot;/lang&quot;))
+    ML10n.add_localization_dir(File.expand_path(File.dirname(__FILE__) + &quot;/other_lang_dir&quot;))
+    ML10n.load_localization!
   end
 
   it &quot;should babelize a word in English &quot; do</diff>
      <filename>spec/m_i18n_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,51 +1,50 @@
 require File.dirname(__FILE__) + '/spec_helper'
 
 describe &quot;ML10n&quot; do
-  include ML10n
   
   before(:each) do
     @lang_test_path = File.expand_path(File.dirname(__FILE__) + &quot;/lang&quot;)
     @lang_test_path_2 = File.expand_path(File.dirname(__FILE__) + &quot;/other_lang_dir&quot;)
-    reset_localization_files_and_dirs!
+    ML10n.reset_localization_files_and_dirs!
   end
   
   it &quot;should have a list of localization directories&quot; do
-    localization_dirs.should == Merb::Plugins.config[:merb_babel][:localization_dirs]
+    ML10n.localization_dirs.should == Merb::Plugins.config[:merb_babel][:localization_dirs]
   end
   
   it &quot;should be able to add a new localization directory&quot; do
-    add_localization_dir(@lang_test_path)
-    localization_dirs.include?(@lang_test_path)
+    ML10n.add_localization_dir(@lang_test_path)
+    ML10n.localization_dirs.include?(@lang_test_path)
   end
   
   it &quot;should have a list of localization source files&quot; do
-    localization_files.should == []
-    add_localization_dir(@lang_test_path)
-    localization_files.include?(&quot;#{@lang_test_path}/en.yml&quot;).should be_true
-    localization_files.include?(&quot;#{@lang_test_path}/en-US.yml&quot;).should be_true
+    ML10n.localization_files.should == []
+    ML10n.add_localization_dir(@lang_test_path)
+    ML10n.localization_files.include?(&quot;#{@lang_test_path}/en.yml&quot;).should be_true
+    ML10n.localization_files.include?(&quot;#{@lang_test_path}/en-US.yml&quot;).should be_true
   end
   
   it &quot;should load localization files and have them available&quot; do
-    add_localization_dir(@lang_test_path)
-    load_localization!
-    localizations['en'][:right].should == 'right'
-    localizations['en'][:left].should == 'left'
-    localizations['en']['US'][:greetings].should == 'Howdie'
+    ML10n.add_localization_dir(@lang_test_path)
+    ML10n.load_localization!
+    ML10n.localizations['en'][:right].should == 'right'
+    ML10n.localizations['en'][:left].should == 'left'
+    ML10n.localizations['en']['US'][:greetings].should == 'Howdie'
   end
   
   it &quot;should load more localization files and have them available&quot; do
-    add_localization_dir(@lang_test_path)
-    load_localization!
-    localizations['en'][:right].should == 'right'
-    localizations.has_key?('fr').should be_false
+    ML10n.add_localization_dir(@lang_test_path)
+    ML10n.load_localization!
+    ML10n.localizations['en'][:right].should == 'right'
+    ML10n.localizations.has_key?('fr').should be_false
     
-    add_localization_dir(@lang_test_path_2)
-    load_localization!
-    localizations['en'][:right].should == 'right'
-    localizations.has_key?('fr').should be_true
-    localizations['fr'][:right].should == 'la droite'
-    localizations['fr'][:left].should == 'la gauche'
-    localizations['fr'][:greetings].should == 'Salut'
+    ML10n.add_localization_dir(@lang_test_path_2)
+    ML10n.load_localization!
+    ML10n.localizations['en'][:right].should == 'right'
+    ML10n.localizations.has_key?('fr').should be_true
+    ML10n.localizations['fr'][:right].should == 'la droite'
+    ML10n.localizations['fr'][:left].should == 'la gauche'
+    ML10n.localizations['fr'][:greetings].should == 'Salut'
   end
   
 end
\ No newline at end of file</diff>
      <filename>spec/m_l10n_spec.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,7 @@
 $TESTING=true
 $:.push File.join(File.dirname(__FILE__), '..', 'lib')
 require &quot;rubygems&quot;
+require &quot;spec&quot;
 require &quot;merb-core&quot;
 require File.join(File.dirname(__FILE__), &quot;..&quot;, 'lib', 'merb_babel')
 </diff>
      <filename>spec/spec_helper.rb</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>README</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>b981a54558902f45dc269d7bc5a2aba4eef651a6</id>
    </parent>
  </parents>
  <author>
    <name>Matt Aimonetti</name>
    <email>mattaimonetti@gmail.com</email>
  </author>
  <url>http://github.com/mattetti/merb_babel/commit/62de188a3d95a3dd577083128f87ffc52d67b445</url>
  <id>62de188a3d95a3dd577083128f87ffc52d67b445</id>
  <committed-date>2008-12-14T23:59:14-08:00</committed-date>
  <authored-date>2008-12-14T23:59:14-08:00</authored-date>
  <message>moved ML10n stuff around</message>
  <tree>86bea3d7ddc55f0bf67359116ed53547b3b57c2b</tree>
  <committer>
    <name>Matt Aimonetti</name>
    <email>mattaimonetti@gmail.com</email>
  </committer>
</commit>
