| Class | Lafcadio::English |
| In: |
lafcadio/util.rb
|
| Parent: | Object |
A collection of English-language specific utility methods.
Turns a camel-case string ("camel_case_to_english") to plain English ("camel case to english"). Each word is decapitalized.
Returns the proper noun form of a string by capitalizing most of the words.
Examples:
English.proper_noun("bosnia and herzegovina") ->
"Bosnia and Herzegovina"
English.proper_noun("macedonia, the former yugoslav republic of") ->
"Macedonia, the Former Yugoslav Republic of"
English.proper_noun("virgin islands, u.s.") ->
"Virgin Islands, U.S."
Given a format for a template sentence, generates the sentence while accounting for details such as pluralization and whether to use "a" or "an".
Examples:
English.sentence("There %is currently %num %nam", "product category",
0) -> "There are currently 0 product categories"
English.sentence("There %is currently %num %nam", "product category",
1) -> "There is currently 1 product category"
English.sentence("Add %a %nam", "invoice") -> "Add an invoice"