Преглед изворни кода

[DOCUMENTATION] Updated docs on the Zend_App Local Resource Plugin

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20046 44c647ce-9c0f-0410-b52a-842ac1e357ba
freak пре 16 година
родитељ
комит
5baf3ecfdc

+ 26 - 8
documentation/manual/en/module_specs/Zend_Application-AvailableResources-Locale.xml

@@ -12,21 +12,23 @@
         There are basically three uses of the Locale Resource Plugin.
         There are basically three uses of the Locale Resource Plugin.
         With one you don't specify any options for the Resource Plugin.
         With one you don't specify any options for the Resource Plugin.
         By doing so, <classname>Zend_Locale</classname> tries to determine
         By doing so, <classname>Zend_Locale</classname> tries to determine
-        what locale to use, and that's it.
+        what locale to use, and that's it. Doing so is not adivsed. There are
+        cases in which <classname>Zend_Locale</classname> cannot detect the
+        locale of the user, resulting in an exception. For more info on how
+        locales are detected, please see the chapter on <link
+        linkend="zend.locale.selection.automatic">automatic locale detection</link>.
     </para>
     </para>
     
     
-    <example id="zend.application.available-resources.locale.configExample">
-        <title>Sample Locale Resource Configuration</title>
+    <example id="zend.application.available-resources.locale.configExampleDetectAndFallback">
+        <title>Autodetect locale as well as setting a fallback</title>
 
 
         <para>
         <para>
-            For the other two uses, please see the code sample below.
+            Another possibility is to automatically detect the locale to use,
+            but, when none can be found, still fall back to the pre-configured
+            locale. This is advised for any application that needs to be localized. 
         </para>
         </para>
 
 
         <programlisting language="ini"><![CDATA[
         <programlisting language="ini"><![CDATA[
-; No matter what, the nl_NL locale will be used.
-resources.locale.default = "nl_NL"
-resources.locale.force = true
-
 ; Try to determine automatically first,
 ; Try to determine automatically first,
 ; if unsuccessful, use nl_NL as fallback.
 ; if unsuccessful, use nl_NL as fallback.
 resources.locale.default = "nl_NL"
 resources.locale.default = "nl_NL"
@@ -38,4 +40,20 @@ resources.locale.force = false
             force-directive defaults to false.
             force-directive defaults to false.
         </para>
         </para>
     </example>
     </example>
+    
+    <example id="zend.application.available-resources.locale.configExampleFallbackOnly">
+        <title>Setting a locale only</title>
+
+        <para>
+            The last option is to only set a preconfigured locale which is used
+            in all cases. This comes in handy when you want the same locale
+            throughout your entire application.
+        </para>
+
+        <programlisting language="ini"><![CDATA[
+; No matter what, the nl_NL locale will be used.
+resources.locale.default = "nl_NL"
+resources.locale.force = true
+]]></programlisting>
+    </example>
 </sect2>
 </sect2>

+ 2 - 2
tests/Zend/Application/Resource/LogTest.php

@@ -133,8 +133,8 @@ public function testNumericLogStreamFilterParamsPriorityDoesNotFail() {
                         array('writerName'   => 'Stream',
                         array('writerName'   => 'Stream',
                               'writerParams' => array('stream' => "php://memory",
                               'writerParams' => array('stream' => "php://memory",
                                                       'mode' => 'a'),
                                                       'mode' => 'a'),
-                        array('filterName' => 'Priority'),
-                        array('filterParams' => array('priority' => '4'))));
+                        'filterName' => 'Priority',
+                        'filterParams' => array('priority' => '4')));
         $resource = new Zend_Application_Resource_Log($options);
         $resource = new Zend_Application_Resource_Log($options);
         $resource->setBootstrap($this->bootstrap);
         $resource->setBootstrap($this->bootstrap);
         $resource->init();
         $resource->init();