-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Czech language support fixed and improved (#148)
* Czech Language Support
- Loading branch information
Showing
28 changed files
with
696 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
cs: | ||
numbers: | ||
union: '' | ||
union_separator: '' | ||
integral: celých | ||
ones: | ||
male: [nula, jeden, dva, tři, čtyři, pět, šest, sedm, osm, devět] | ||
female: [nula, jedna, dvě, tři, čtyři, pět, šest, sedm, osm, devět] | ||
neuter: [nula, jedno, dvě, tři, čtyři, pět, šest, sedm, osm, devět] | ||
teens: [deset, jedenáct, dvanáct, třináct, čtrnáct, patnáct, šestnáct, sedmnáct, osmnáct, devatenáct] | ||
tens: [_, deset, dvacet, třicet, čtyřicet, padesát, šedesát, sedmdesát, osmdesát, devadesát] | ||
hundreds: [_, jedno sto, dvě stě, tři sta, čtyři sta, pět set, šest set, sedm set, osm set, devět set] | ||
# gem pouziva se deleni po 10^3, http://www.converter.cz/prevody/velka-cisla.htm | ||
# mega: [ones, thousands, miliony, miliardy, biliony, biliardy, triliony, triliardy, quadriliony, quadriliardy] | ||
micro: | ||
one: [_, desetina, setina, tisícina, milióntina, miliardtina, bilióntina] | ||
few: [_, desetiny, setiny, tisíciny, milióntiny, miliardtiny, bilióntiny] | ||
many: [_, desetin, setin, tisícin, milióntin, miliardtin, bilióntin] | ||
sub_micro: [_, deseti, sto] | ||
thousands: | ||
one: tisíc | ||
few: tisíce | ||
many: tisíc | ||
millions: | ||
one: milión | ||
few: milióny | ||
many: miliónů | ||
billions: | ||
one: miliarda | ||
few: miliardy | ||
many: miliard | ||
trillions: | ||
one: bilion | ||
few: biliony | ||
many: bilionů | ||
quadrillions: | ||
one: biliarda | ||
few: biliardy | ||
many: biliard | ||
quintillion: | ||
one: trilion | ||
few: triliony | ||
many: trilionů | ||
sextillions: | ||
one: triliarda | ||
few: triliardy | ||
many: triliard | ||
septillions: | ||
one: kvadrilion | ||
few: kvadriliony | ||
many: kvadrilionů | ||
octillions: | ||
one: kvadriliarda | ||
few: kvadriliardy | ||
many: kvadriliard | ||
mega: | ||
- ones | ||
- thousands | ||
- millions | ||
- billions | ||
- trillions | ||
- quadrillions | ||
- quintillion | ||
- sextillions | ||
- septillions | ||
- octillions | ||
ordinal: | ||
ones: | ||
male: [nultý, první, druhý, třetí, čtvrtý, pátý, šestý, sedmý, osmý, devátý] | ||
female: [nultá, první, druhá, třetí, čtvrtá, pátá, šestá, sedmá, osmá, devátá] | ||
neuter: [nulté, první, druhé, třetí, čtvrté, páté, šesté, sedmé, osmé, deváté] | ||
teens: | ||
male: [desátý, jedenáctý, dvanáctý, třináctý, čtrnáctý, patnáctý, šestnáctý, sedmnáctý, osmnáctý, devatenáctý] | ||
female: [desátá, jedenáctá, dvanáctá, třináctá, čtrnáctá, patnáctá, šestnáctá, sedmnáctá, osmnáctá, devatenáctá] | ||
neuter: [desáté, jedenácté, dvanácté, třinácté, čtrnácté, patnácté, šestnácté, sedmnácté, osmnácté, devatenácté] | ||
tens: | ||
male: [_, desátý, dvacátý, třicátý, čtyřicátý, padesátý, šedesátý, sedmdesátý, osmdesátý, devadesátý] | ||
female: [_, desátá, dvacátá, třicátá, čtyřicátá, padesátá, šedesátá, sedmdesátá, osmdesátá, devadesátá] | ||
neuter: [_, desáté, dvacáté, třicáté, čtyřicáté, padesáté, šedesáté, sedmdesáté, osmdesáté, devadesáté] | ||
hundreds: | ||
male: [_, stý, dvoustý, třístý, čtyřstý, pětistý, šestistý, sedmistý, osmistý, devítistý] | ||
female: [_, stá, dvoustá, třístá, čtyřstá, pětistá, šestistá, sedmistá, osmistá, devítistá] | ||
neuter: [_, sté, dvousté, třísté, čtyřsté, pětisté, šestisté, sedmisté, osmisté, devítisté] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
module NumbersAndWords | ||
module I18n | ||
module Plurals | ||
module Cs | ||
module_function | ||
|
||
RULE = lambda do |n| | ||
if one_conditions(n) | ||
:one | ||
elsif few_conditions(n) | ||
:few | ||
elsif many_conditions(n) | ||
:many | ||
else | ||
:other | ||
end | ||
end | ||
|
||
def one_conditions(n) | ||
n % 10 == 1 && n % 100 != 11 | ||
end | ||
|
||
def few_conditions(n) | ||
[2, 3, 4].include?(n % 10) && ![12, 13, 14].include?(n % 100) | ||
end | ||
|
||
def many_conditions(n) | ||
(n % 10).zero? || [5, 6, 7, 8, 9].include?(n % 10) || [11, 12, 13, 14].include?(n % 100) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
lib/numbers_and_words/strategies/array_joiner/languages/cs.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module ArrayJoiner | ||
module Languages | ||
class Cs < Base | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
lib/numbers_and_words/strategies/figures_converter/decorators/cs.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
require 'numbers_and_words/strategies/figures_converter/decorators/cs/base' | ||
require 'numbers_and_words/strategies/figures_converter/decorators/cs/fractional' | ||
require 'numbers_and_words/strategies/figures_converter/decorators/cs/integral' |
12 changes: 12 additions & 0 deletions
12
lib/numbers_and_words/strategies/figures_converter/decorators/cs/base.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Cs | ||
class Base < Decorators::Base | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
38 changes: 38 additions & 0 deletions
38
lib/numbers_and_words/strategies/figures_converter/decorators/cs/fractional.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Cs | ||
class Fractional < Base | ||
def run | ||
@options[:gender] = :female | ||
"#{super} #{fraction_significance}" | ||
end | ||
|
||
private | ||
|
||
def fraction_significance | ||
@strategy.translations.micros full_fraction.fraction_capacity, figures.reverse.join.to_i | ||
end | ||
|
||
def full_fraction | ||
(0..zero_length).inject(figures.clone) { |result, _el| result.unshift '0' }.to_figures | ||
end | ||
|
||
def figures | ||
@strategy.figures | ||
end | ||
|
||
def zero_length | ||
fraction_length - figures.length | ||
end | ||
|
||
def fraction_length | ||
@options[:fractional][:length].to_i | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
28 changes: 28 additions & 0 deletions
28
lib/numbers_and_words/strategies/figures_converter/decorators/cs/integral.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Cs | ||
class Integral < Base | ||
def run | ||
@options[:gender] = :female | ||
[super, integral_significance].compact.join(' ') | ||
end | ||
|
||
private | ||
|
||
def integral_significance | ||
figs = figures.reverse.join.to_i | ||
return nil if @options[:remove_zero] && figs.zero? | ||
@strategy.translations.integral figs | ||
end | ||
|
||
def figures | ||
@strategy.language.figures | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.