-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#77 Merge branch 'feature/add_lithuanian_language' into development
- Loading branch information
Showing
10 changed files
with
219 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
lt: | ||
numbers: | ||
ones: [nulis, vienas, du, trys, keturi, penki, šeši, septyni, aštuoni, devyni] | ||
teens: [dešimt, vienuolika, dvylika, trylika, keturiolika, penkiolika, šešiolika, septyniolika, aštuoniolika, devyniolika] | ||
tens: [nulis, dešimt, dvidešimt, trisdešimt, keturiasdešimt, penkiasdešimt, šešiasdešimt, septyniasdešimt, aštuoniasdešimt, devyniasdešimt] | ||
mega: [ones, thousands, millions, billions, trillions, quadrillions, quintillion, sextillions, septillions, octillions, nonillions, decillions] | ||
hundreds: [šimtas, du šimtai, trys šimtai, keturi šimtai, penki šimtai, šeši šimtai, septyni šimtai, aštuoni šimtai, devyni šimtai] | ||
one_hundred: šimtas | ||
thousands: | ||
one: tūkstantis | ||
ones: tūkstančiai | ||
other: tūkstančių | ||
millions: | ||
one: milijonas | ||
ones: milijonai | ||
other: milijonø | ||
billions: | ||
one: bilijonas | ||
ones: bilijonai | ||
other: bilijonø | ||
trillions: | ||
one: trilijonas | ||
ones: trilijonai | ||
other: trilijonø | ||
quadrillions: | ||
one: kvadrilijonas | ||
ones: kvadrilijonai | ||
other: kvadrilijonø | ||
quintillions: | ||
one: kvintilijonas | ||
ones: kvadrilijonai | ||
other: kvadrilijonø | ||
sextillions: | ||
one: sekstilijonas | ||
ones: sekstilijonai | ||
other: sekstilijonø | ||
septillions: | ||
one: septilijonas | ||
ones: septilijonai | ||
other: septilijonø | ||
octillions: | ||
one: oktilijonas | ||
ones: oktilijonai | ||
other: oktilijonø | ||
nonillions: | ||
one: nonilijonas | ||
ones: nonilijonai | ||
other: nonilijonø | ||
decillions: | ||
one: decilijonas | ||
ones: decilijonai | ||
other: decilijonø |
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,24 @@ | ||
module NumbersAndWords | ||
module I18n | ||
module Plurals | ||
module Lt | ||
RULE = lambda do |n| | ||
one_conditions(n) ? | ||
:one : ones_conditions(n) ? | ||
:ones : :other | ||
end | ||
|
||
extend self | ||
|
||
def one_conditions n | ||
n % 10 == 1 && n % 100 != 11 | ||
end | ||
|
||
def ones_conditions n | ||
[2, 3, 4, 5, 6, 7, 8, 9].include?(n % 10) && ![12, 13, 14, 15, 16, 17, 18, 19].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
37 changes: 37 additions & 0 deletions
37
lib/numbers_and_words/strategies/figures_converter/languages/lt.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,37 @@ | ||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Languages | ||
class Lt < Base | ||
include Families::Latin | ||
|
||
private | ||
|
||
def capacity_iteration | ||
words = [] | ||
capacity_words = words_in_capacity(@current_capacity) | ||
words.push(megs) unless capacity_words.empty? | ||
words += capacity_words unless is_a_thousand? and is_a_one? | ||
words | ||
end | ||
|
||
def is_a_one? | ||
[translations.ones(1)] == words_in_capacity(@current_capacity) | ||
end | ||
|
||
def is_a_thousand? | ||
FiguresArray::THOUSAND_CAPACITY == @current_capacity | ||
end | ||
|
||
def hundreds | ||
super({:is_hundred => (figures[1,2] == [0,1] && simple_number_to_words.empty?)}) | ||
end | ||
|
||
def megs | ||
super({:number => @figures.number_in_capacity(@current_capacity)}) | ||
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
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,21 @@ | ||
module NumbersAndWords | ||
module Translations | ||
class Lt < Base | ||
include NumbersAndWords::Translations::Families::Latin | ||
|
||
def tens number, options = {} | ||
super(number) | ||
end | ||
|
||
def tens_with_ones numbers, options = {} | ||
[tens(numbers[1], :alone => false), ones(numbers[0])].join ' ' | ||
end | ||
|
||
|
||
def hundreds number, options = {} | ||
options[:is_hundred] = false if options[:is_hundred].nil? | ||
options[:is_hundred] ? t(:one_hundred) : t(:hundreds)[number - 1] | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
to_words: | ||
simple_example: | ||
? | ||
- 1 | ||
- 2 | ||
- 3 | ||
: | ||
- vienas | ||
- du | ||
- trys | ||
complex_example: | ||
? | ||
- 101 | ||
- 21 | ||
- 13 | ||
: | ||
- šimtas vienas | ||
- dvidešimt vienas | ||
- trylika |
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,50 @@ | ||
to_words: | ||
ones: | ||
0: nulis | ||
1: vienas | ||
9: devyni | ||
teens: | ||
10: dešimt | ||
11: vienuolika | ||
19: devyniolika | ||
20: dvidešimt | ||
21: dvidešimt vienas | ||
90: devyniasdešimt | ||
99: devyniasdešimt devyni | ||
hundreds: | ||
100: šimtas | ||
101: šimtas vienas | ||
111: šimtas vienuolika | ||
120: šimtas dvidešimt | ||
121: šimtas dvidešimt vienas | ||
900: devyni šimtai | ||
909: devyni šimtai devyni | ||
919: devyni šimtai devyniolika | ||
990: devyni šimtai devyniasdešimt | ||
999: devyni šimtai devyniasdešimt devyni | ||
thousands: | ||
1000: tūkstantis | ||
2000: du tūkstančiai | ||
4000: keturi tūkstančiai | ||
5000: penki tūkstančiai | ||
11000: vienuolika tūkstančių | ||
21000: dvidešimt vienas tūkstantis | ||
999000: devyni šimtai devyniasdešimt devyni tūkstančiai | ||
999999: devyni šimtai devyniasdešimt devyni tūkstančiai devyni šimtai devyniasdešimt devyni | ||
millions: | ||
1000000: vienas milijonas | ||
2000000: du milijonai | ||
4000000: keturi milijonai | ||
5000000: penki milijonai | ||
999000000: devyni šimtai devyniasdešimt devyni milijonai | ||
999000999: devyni šimtai devyniasdešimt devyni milijonai devyni šimtai devyniasdešimt devyni | ||
999999000: devyni šimtai devyniasdešimt devyni milijonai devyni šimtai devyniasdešimt devyni tūkstančiai | ||
999999999: devyni šimtai devyniasdešimt devyni milijonai devyni šimtai devyniasdešimt devyni tūkstančiai devyni šimtai devyniasdešimt devyni | ||
billions: | ||
1174315110: vienas bilijonas šimtas septyniasdešimt keturi milijonai trys šimtai penkiolika tūkstančių šimtas dešimt | ||
1174315119: vienas bilijonas šimtas septyniasdešimt keturi milijonai trys šimtai penkiolika tūkstančių šimtas devyniolika | ||
15174315110: penkiolika bilijonø šimtas septyniasdešimt keturi milijonai trys šimtai penkiolika tūkstančių šimtas dešimt | ||
35174315119: trisdešimt penki bilijonai šimtas septyniasdešimt keturi milijonai trys šimtai penkiolika tūkstančių šimtas devyniolika | ||
935174315119: devyni šimtai trisdešimt penki bilijonai šimtas septyniasdešimt keturi milijonai trys šimtai penkiolika tūkstančių šimtas devyniolika | ||
trillions: | ||
2935174315119: du trilijonai devyni šimtai trisdešimt penki bilijonai šimtas septyniasdešimt keturi milijonai trys šimtai penkiolika tūkstančių šimtas devyniolika |