<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -112,7 +112,13 @@ module I18n
               # for each string method in the patern, in order, execute that
               # method on the returned value, and overwrite value
               pattern.gsub(/\.(#{string_methods.join('|')})/) do
-                value = value.respond_to?($1) ? value.send($1) : value
+                if $1 == 'pluralize'
+                  value = pluralize_with_locale(locale, value)
+                elsif $1 == 'singularize'
+                  value = singularize_with_locale(locale, value)
+                else
+                  value = value.respond_to?($1) ? value.send($1) : value
+                end
               end
 
               # return the translated, and string method executed value
@@ -124,6 +130,43 @@ module I18n
 
           interpolate_orig(locale, string, values)
         end
+
+        PluralizeValues = {
+          :mi =&gt; { :prefix =&gt; 'nga' }
+        }
+        SingularizeValues = {
+          :mi =&gt; { :prefix =&gt; 'te' }
+        }
+
+        def pluralize_with_locale(locale, string)
+          if PluralizeValues[locale.to_sym]
+            string = strip_prefix_and_suffix(locale, string)
+            PluralizeValues[locale.to_sym][:prefix].to_s + string + PluralizeValues[locale.to_sym][:suffix].to_s
+          else
+            string.pluralize
+          end
+        end
+
+        def singularize_with_locale(locale, string)
+          if SingularizeValues[locale.to_sym]
+            string = strip_prefix_and_suffix(locale, string)
+            SingularizeValues[locale.to_sym][:prefix].to_s + string + SingularizeValues[locale.to_sym][:suffix].to_s
+          else
+            string.singularize
+          end
+        end
+
+        def strip_prefix_and_suffix(locale, string)
+          # strip any prefixes for this locale
+          string.gsub!(/^#{PluralizeValues[locale.to_sym][:prefix]}/, '') unless PluralizeValues[locale.to_sym][:prefix].blank?
+          string.gsub!(/^#{SingularizeValues[locale.to_sym][:prefix]}/, '') unless SingularizeValues[locale.to_sym][:prefix].blank?
+
+          # strip any suffixes for this locale
+          string.gsub!(/#{PluralizeValues[locale.to_sym][:suffix]}$/, '') unless PluralizeValues[locale.to_sym][:suffix].blank?
+          string.gsub!(/#{SingularizeValues[locale.to_sym][:suffix]}$/, '') unless SingularizeValues[locale.to_sym][:suffix].blank?
+
+          string
+        end
     end
   end
 end</diff>
      <filename>config/initializers/all_extensions.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>32582da2df4f477f3a8feacdb440f8754bf622d7</id>
    </parent>
  </parents>
  <author>
    <name>Kieran Pilkington</name>
    <email>kieran@katipo.co.nz</email>
  </author>
  <url>http://github.com/kete/kete/commit/e1c35496a06927334f9e3014773f7538729246dc</url>
  <id>e1c35496a06927334f9e3014773f7538729246dc</id>
  <committed-date>2009-10-29T14:49:48-07:00</committed-date>
  <authored-date>2009-10-29T14:49:48-07:00</authored-date>
  <message>refinement: Adding code to supply custom pluralize and singularize values for locales. Strips existing prefix or suffixes and then applies them as needed. Falls back to Rails pluralize/singularize methods.</message>
  <tree>3647cdaaaeefc3987df90508f65ba4689e39fff7</tree>
  <committer>
    <name>Kieran Pilkington</name>
    <email>kieran@katipo.co.nz</email>
  </committer>
</commit>
