Skip to content

Commit 4c009e0

Browse files
committed
Add the option to make inflector rules localized
1 parent e6052ce commit 4c009e0

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

classes/inflector.html

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,17 @@ <h1>
4747

4848
<h2>Inflector Class</h2>
4949

50-
<p>The Inflector class allows you to transforms words from singular to plural, class names to table names, modularized class names to ones without, and class names to foreign keys.</p>
50+
<p>
51+
The Inflector class allows you to transforms words from singular to plural,
52+
class names to table names, modularized class names to ones without,
53+
and class names to foreign keys.
54+
</p>
55+
<p>
56+
Inflector rulesets can be defined as language files, to be able to localize them.
57+
The framework comes with a default set of rules for the English language, which
58+
can act as a template for localisation.
59+
</p>
60+
5161

5262
<article>
5363
<h4 class="method" id="method_ascii">ascii($str, $allow_non_ascii = false)</h4>
@@ -735,6 +745,41 @@ <h4 class="method" id="method_underscore">underscore($camel_cased_word)</h4>
735745
</table>
736746
</article>
737747

748+
<article>
749+
<h4 class="method" id="method_load_rules">load_rules()</h4>
750+
<p>
751+
The <strong>load_rules</strong> method loads the inflector rules based on the current
752+
language configuration. If no rulesset can be found (i.e. no inflector lang file exists),
753+
the class will default to a ruleset for the English language. If you have loaded a ruleset,
754+
you change your language configuration, reload again, but the new configuration doesn't have
755+
a ruleset defined, Inflector will continue to use the current one.
756+
</p>
757+
<p class="note">
758+
Upon first use the Inflector class will autoload the the ruleset based on the language
759+
configuration. Normally you do not have to use this method.
760+
</p>
761+
<table class="method">
762+
<tbody>
763+
<tr>
764+
<th class="legend">Static</th>
765+
<td>Yes</td>
766+
</tr>
767+
<tr>
768+
<th>Parameters</th>
769+
<td>
770+
None
771+
</td>
772+
</tr>
773+
<tr>
774+
<th>Example</th>
775+
<td>
776+
<pre class="php"><code>Inflector::load_rules(); // (re)loads the Inflector ruleset</code></pre>
777+
</td>
778+
</tr>
779+
</tbody>
780+
</table>
781+
</article>
782+
738783
</div>
739784

740785
<footer>

0 commit comments

Comments
 (0)