Author: edng
Date: 2010-09-10 03:15:39 +0200 (Fri, 10 Sep 2010)
New Revision: 30866

Added:
   plugins/sfI18NGettextPluralPlugin/tags/1.0.0/
   plugins/sfI18NGettextPluralPlugin/tags/1.0.0/LICENSE
   plugins/sfI18NGettextPluralPlugin/tags/1.0.0/README
   plugins/sfI18NGettextPluralPlugin/tags/1.0.0/lib/
   plugins/sfI18NGettextPluralPlugin/tags/1.0.0/package.xml
Log:


Copied: plugins/sfI18NGettextPluralPlugin/tags/1.0.0/LICENSE (from rev 30865, 
plugins/sfI18NGettextPluralPlugin/trunk/LICENSE)
===================================================================
--- plugins/sfI18NGettextPluralPlugin/tags/1.0.0/LICENSE                        
        (rev 0)
+++ plugins/sfI18NGettextPluralPlugin/tags/1.0.0/LICENSE        2010-09-10 
01:15:39 UTC (rev 30866)
@@ -0,0 +1,7 @@
+Copyright (c) 2010 Edwood Ng
+
+Permission is hereby granted, free of charge, to any person obtaining a copy 
of this software and associated documentation files (the "Software"), to deal 
in the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 
of the Software, and to permit persons to whom the Software is furnished to do 
so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.

Copied: plugins/sfI18NGettextPluralPlugin/tags/1.0.0/README (from rev 30865, 
plugins/sfI18NGettextPluralPlugin/trunk/README)
===================================================================
--- plugins/sfI18NGettextPluralPlugin/tags/1.0.0/README                         
(rev 0)
+++ plugins/sfI18NGettextPluralPlugin/tags/1.0.0/README 2010-09-10 01:15:39 UTC 
(rev 30866)
@@ -0,0 +1,90 @@
+sfI18NGettextPluralPlugin
+=========================
+
+The `sfI18NGettextPluralPlugin` extends sfI18N to provide extended support on 
Gettext PO/MO file's plural forms format.  
+
+This plugin will interpret the plural form formula, that's usually located in 
PO/MO file's meta data section, to remove the need to specify the formula when 
you use format_number_choice.  This is especially important for application 
that supports languages with more complex plural forms such as Russian.  This 
plugin also fixes an issue in current sfI18N implementation where it doesn't 
break down the plural forms into individual translated text.  When a 
translation has plural form, the singular and plural form's text would be 
merged.
+
+Content
+-------
+  * `sfI18NGettextPlural.class.php` class which extends sfI18N
+  * `sfMessageFormatPlural.class.php` class which extends sfMessageFormat
+  * `sfMessageSource_gettextPlural.class.php` class which extends 
sfMessageSource_gettext
+  * `I18NPluralHelper.php` adds a new function called __plural($text, $plural, 
$args, $catalogue)
+
+Installation
+------------
+
+  * Install the plugin
+
+        $ symfony plugin:install sfI18NGettextPluralPlugin
+
+  * Change i18n class in `factories.yml` from `sfI18N` to 
`sfI18NGettextPlural` and add/modify params `source` to `gettextPlural`
+  
+        all:
+          i18n:
+            class: sfI18NGettextPlural
+            param:
+              source: gettextPlural
+        
+  * Create PO and MO files and place it in i18n directory of your app. (e.g. 
/apps/frontend/i18n/<language>)  MO files are binary format of the PO and MO 
files will be read by this plugin.  You can convert PO to MO with the `msgfmt` 
tool.
+  
+  * Enable `i18n` in `settings.yml`
+
+        all:
+          .settings:
+            i18n: true
+
+  * Add I18N and I18NPlural helpers
+
+        all:
+          .settings:
+            standard_helpers: [Partial, Cache, I18N, I18NPlural]
+        
+  * Clear the cache
+
+        $ symfony cache:clear
+
+How plugin works
+----------------
+
+The plugin will first look for `Plural-Forms` in the PO/MO file's meta data 
section and store it as `%PLURAL-FORMS%` in the same translation associative 
array.  The plural forms is stored as an array under a formulated key 
`<singular form>|<plural form>`.  For example, Russian has 1 singular and 2 
plural forms.  In the PO/MO's header section, you will need to specify the 
formula as follow:
+
+    "Plural-Forms: nplurals=3; 
plural=((((n%10)==1)&&((n%100)!=11))?(0):(((((n%10)>=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));"
+
+In the translation, you will have something like this:
+
+    msgid "1 student"
+    msgid_plural "@count students"
+    msgstr[0] "@count человек"
+    msgstr[1] "@count человека"
+    msgstr[2] "@count человек"
+
+After we parse the MO file, the associative array will have following (this is 
for illustrative purpose only, the actual array is slightly different):
+
+    '%PLURAL-FORMS' => 
'((((n%10)==1)&&((n%100)!=11))?(0):(((((n%10)>=2)&&((n%10)<=4))&&(((n%100)<10)||((n%100)>=20)))?(1):2));\n'
+    '1 student' => '1 человек'
+    '1 student|@count students' => Array( [0] => '@count человек'
+                                          [1] => '@count человека'
+                                          [2] => '@count человек' )
+
+A new function is added for producing plural forms translation.
+
+    __plural($text, $plural, $args, $catalogue)
+
+Example:
+
+    __plural('1 student','@count students', array('@count' => '2'));
+
+You can continue to use the usual __($text, $args, $catalogue) function for 
singular form translation.  
+
+* Note that the first parameter is used for plural form calculation.  If you 
have other parameters you like to insert before the numeric value, you will 
have to break up the translation to ensure the numeric value always appears as 
the first parameter.
+
+* Also, keep in mind that there is a chance of naming collision with 
`%PLURAL-FORMS%` and the generated plural form key `<singular form>|<plural 
form>`.  Please make sure you don't use any of such form as your normal 
translation key.
+
+Changelog
+---------
+
+### 2010-09-09 | 1.0.0 Stable
+
+ * edng: Initial release (symfony 1.4)

Copied: plugins/sfI18NGettextPluralPlugin/tags/1.0.0/package.xml (from rev 
30865, plugins/sfI18NGettextPluralPlugin/trunk/package.xml)
===================================================================
--- plugins/sfI18NGettextPluralPlugin/tags/1.0.0/package.xml                    
        (rev 0)
+++ plugins/sfI18NGettextPluralPlugin/tags/1.0.0/package.xml    2010-09-10 
01:15:39 UTC (rev 30866)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<package packagerversion="1.4.6" version="2.0" 
xmlns="http://pear.php.net/dtd/package-2.0"; 
xmlns:tasks="http://pear.php.net/dtd/tasks-1.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0 
http://pear.php.net/dtd/tasks-1.0.xsd http://pear.php.net/dtd/package-2.0 
http://pear.php.net/dtd/package-2.0.xsd";>
+ <name>sfI18NGettextPluralPlugin</name>
+ <channel>plugins.symfony-project.org</channel>
+ <summary>The `sfI18NGettextPluralPlugin` extends sfI18N to provide extended 
support on Gettext PO/MO file's plural forms format.</summary>
+ <description>This plugin will interpret the plural form formula, that's 
usually located in PO/MO file's meta data section, to remove the need to 
specify the formula when you use format_number_choice.  This is especially 
important for application that supports languages with more complex plural 
forms such as Russian.  This plugin also fixes an issue in current sfI18N 
implementation where it doesn't break down the plural forms into individual 
translated text.  When a translation has plural form, the singular and plural 
form's text would be merged.</description>
+ <lead>
+  <name>Edwood Ng</name>
+  <user>edng</user>
+  <email>[email protected]</email>
+  <active>yes</active>
+ </lead>
+ <date>2010-09-09</date>
+ <time>20:00:00</time>
+ <version>
+  <release>1.0.0</release>
+  <api>1.0.0</api>
+ </version>
+ <stability>
+  <release>stable</release>
+  <api>stable</api>
+ </stability>
+ <license uri="http://www.symfony-project.org/license";>MIT license</license>
+ <notes>-</notes>
+ <contents>
+  <dir name="/">
+   <file role="data" name="README" />
+   <file role="data" name="LICENSE" />
+   <dir name="lib">
+    <dir name="helper">
+     <file role="data" name="I18NPluralHelper.php" />
+    </dir>
+    <dir name="i18n">
+     <file role="data" name="sfI18NGettextPlural.class.php" />
+     <file role="data" name="sfMessageFormatPlural.php" />
+     <file role="data" name="sfMessageSource_gettextPlural.class.php" />
+    </dir>
+   </dir>
+  </dir>
+ </contents>
+ <dependencies>
+  <required>
+   <php>
+    <min>5.1.0</min>
+   </php>
+   <pearinstaller>
+    <min>1.4.1</min>
+   </pearinstaller>
+   <package>
+    <name>symfony</name>
+    <channel>pear.symfony-project.com</channel>
+    <min>1.4.0</min>
+    <max>1.4.0</max>
+   </package>
+  </required>
+ </dependencies>
+ <phprelease />
+ <changelog />
+</package>
+

-- 
You received this message because you are subscribed to the Google Groups 
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/symfony-svn?hl=en.

Reply via email to