1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
# encoding: UTF-8
module Stringex
module Localization
module DefaultConversions
CHARACTERS = {
and: "and",
at: "at",
degrees: "degrees",
divide: "divided by",
dot: '\1 dot \2',
ellipsis: "dot dot dot",
equals: "equals",
number: "number",
percent: "percent",
plus: "plus",
slash: "slash",
star: "star",
}
CURRENCIES_SIMPLE = {
generic: '\1 dollars',
dollars: '\1 dollars',
euros: '\1 euros',
pounds: '\1 pounds',
yen: '\1 yen',
}
CURRENCIES_COMPLEX = {
dollars_cents: '\1 dollars \2 cents',
euros_cents: '\1 euros \2 cents',
pounds_pence: '\1 pounds \2 pence',
}
CURRENCIES = CURRENCIES_SIMPLE.merge(CURRENCIES_COMPLEX)
HTML_ENTITIES = {
amp: "and",
cent: " cents",
copy: "(c)",
deg: " degrees ",
divide: " divided by ",
double_quote: '"',
ellipsis: "...",
en_dash: "-",
em_dash: "--",
frac14: "one fourth",
frac12: "half",
frac34: "three fourths",
gt: ">",
lt: "<",
nbsp: " ",
pound: " pounds ",
reg: "(r)",
single_quote: "'",
times: "x",
trade: "(tm)",
yen: " yen "
}
TRANSLITERATIONS = {}
# Ordered by denominator then numerator of the value
VULGAR_FRACTIONS = {
half: "half",
one_third: "one third",
two_thirds: "two thirds",
one_fourth: "one fourth",
three_fourths: "three fourths",
one_fifth: "one fifth",
two_fifths: "two fifths",
three_fifths: "three fifths",
four_fifths: "four fifths",
one_sixth: "one sixth",
five_sixths: "five sixths",
one_eighth: "one eighth",
three_eighths: "three eighths",
five_eighths: "five eighths",
seven_eighths: "seven eighths",
}
class << self
%w{characters currencies html_entities transliterations vulgar_fractions}.each do |conversion_type|
define_method conversion_type do
const_get conversion_type.upcase
end
end
end
end
end
end
|