[Solar-svn] Revision 2888

pmjones at solarphp.com pmjones at solarphp.com
Thu Oct 18 08:20:29 CDT 2007


Solar_Locale: [ADD] New method, getCountryCode().  Thanks Antti Holvikari.

fixes #104


Modified: trunk/Solar/Locale.php
===================================================================
--- trunk/Solar/Locale.php	2007-10-18 13:14:52 UTC (rev 2887)
+++ trunk/Solar/Locale.php	2007-10-18 13:20:29 UTC (rev 2888)
@@ -102,9 +102,24 @@
     {
         return $this->_code;
     }
-    
+
     /**
      * 
+     * Returns ISO 3166 country code for current locale code.
+     * 
+     * This is basically just the last two uppercase letters
+     * from the locale code.
+     * 
+     * @return string
+     * 
+     */
+    public function getCountryCode()
+    {
+        return substr($this->_code, -2);
+    }
+
+    /**
+     * 
      * Returns the translated locale string for a class and key.
      * 
      * Loads translations as needed.




More information about the Solar-svn mailing list