inflector

How do you customize transliterations in a Rails 3 app?

爱⌒轻易说出口 提交于 2020-01-02 09:58:51
问题 Ultimately, I would like to use Inflector.parameterize to create slugs for article heading that have a bunch of unicode chars in them (e.g. "ḤellẒ no" => "hellz-no"). According to http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-transliterate it says to put them in the locales/en.yml file. # Store the transliterations in locales/en.yml i18n: transliterate: rule: Ḥ: "h" Ẓ: "z" I tried that but the following does not work: "ḤellẒ no".parameterize # => "ell-no" However,

Define a singular rule in the bootstrap for Inflector

两盒软妹~` 提交于 2020-01-02 05:11:08
问题 I'm using CakePHP 2.1 and need to define an Inflector rule for the word "Software", because CakePHP is converting all references to the plural form "Softwares" which isn't correct. Cake is looking for SoftwaresController and a table named Softwares. I do know to create the rule in the boot strap, and read this doc reference. http://book.cakephp.org/2.0/en/development/configuration.html#inflection-configuration I also took a look at the lib/Cake/Inflector.php file, but can't figure out the

Alternatives to Inflector.Net

别等时光非礼了梦想. 提交于 2019-12-09 04:44:23
问题 I want to use inflector.net in my project. Just googled and it seems to have gone. :-< http://andrewpeters.net/inflectornet/ Are there any alternatives? EDIT (11 May 2011): It looks like Scott Kirkland has taken up the baton: https://github.com/srkirkland/Inflector (Thanks Scott!) 回答1: A Google code search for "Inflector.Net" returned this one: http://cid-net.googlecode.com/svn/trunk/src/Cid.Mvc/Inflector.cs 回答2: http://cid-net.googlecode.com/svn/trunk/src/Cid.Mvc/Inflector.cs used to make

How do you customize transliterations in a Rails 3 app?

不羁的心 提交于 2019-12-06 05:06:40
Ultimately, I would like to use Inflector.parameterize to create slugs for article heading that have a bunch of unicode chars in them (e.g. "ḤellẒ no" => "hellz-no"). According to http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-transliterate it says to put them in the locales/en.yml file. # Store the transliterations in locales/en.yml i18n: transliterate: rule: Ḥ: "h" Ẓ: "z" I tried that but the following does not work: "ḤellẒ no".parameterize # => "ell-no" However, when I change it in Ruby like the second paragraph suggests, it works. I18n.backend.store_translations(

Define a singular rule in the bootstrap for Inflector

自闭症网瘾萝莉.ら 提交于 2019-12-05 08:54:34
I'm using CakePHP 2.1 and need to define an Inflector rule for the word "Software", because CakePHP is converting all references to the plural form "Softwares" which isn't correct. Cake is looking for SoftwaresController and a table named Softwares. I do know to create the rule in the boot strap, and read this doc reference. http://book.cakephp.org/2.0/en/development/configuration.html#inflection-configuration I also took a look at the lib/Cake/Inflector.php file, but can't figure out the syntax for defining a rule. It looks kind of like regex. Here are a few rule examples. '/(s)tatus$/i' => '

Alternatives to Inflector.Net

谁说我不能喝 提交于 2019-12-03 01:58:12
I want to use inflector.net in my project. Just googled and it seems to have gone. :-< http://andrewpeters.net/inflectornet/ Are there any alternatives? EDIT (11 May 2011): It looks like Scott Kirkland has taken up the baton: https://github.com/srkirkland/Inflector (Thanks Scott!) A Google code search for "Inflector.Net" returned this one: http://cid-net.googlecode.com/svn/trunk/src/Cid.Mvc/Inflector.cs http://cid-net.googlecode.com/svn/trunk/src/Cid.Mvc/Inflector.cs used to make https://github.com/markrendle/Inflector which is available via a NuGet Package last updated today! package id=