-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: ✨ support for polish language #189
Open
sectasy0
wants to merge
5
commits into
kslazarev:master
Choose a base branch
from
sectasy0:feature/polish
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
62eec2d
feat: :sparkles: support for polish language
adee1a7
refactor: :recycle: correct rubocop errors. update CHANGELOG.md and R…
18766ed
style: change line endings to unix LF
b85fa23
chore: correct CHANGELOG.md
1e2672c
docs: update CHANGELOG.md and README.rdoc
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
## Unreleased | ||
|
||
### Features | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should go under Next below, that's our unreleased. |
||
* Add polish language support \[[#189](https://github.com/kslazarev/numbers_and_words/pull/189)\] | ||
|
||
## 0.11.12 (Next) | ||
|
||
### Features | ||
|
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,92 @@ | ||
pl: | ||
numbers: | ||
ones: [zero, jeden, dwa, trzy, cztery, pięć, sześć, siedem, osiem, dziewięć] | ||
teens: [_, jedenaście, dwanaście, trzynaście, czternaście, piętnaście, szesnaście, siedemnaście, osiemnaście, dziewiętnaście] | ||
tens: [_, dziesięć, dwadzieścia, trzydzieści, czterdzieści, pięćdziesiąt, sześćdziesiąt, siedemdziesiąt, osiemdziesiąt, dziewięćdziesiąt] | ||
hundreds: [_, sto, dwieście, trzysta, czterysta, pięćset, sześćset, siedemset, osiemset, dziewięćset] | ||
mega: [_, thousands, millions, billions, trillions, quadrillions, quintillions, sextillions, septillions, octillions] | ||
thousands: | ||
one: tysiąc | ||
few: tysiące | ||
many: tysięcy | ||
millions: | ||
one: milion | ||
few: miliony | ||
many: milionów | ||
billions: | ||
one: miliard | ||
few: miliardy | ||
many: miliardów | ||
trillions: | ||
one: bilion | ||
few: biliony | ||
many: bilionów | ||
quadrillions: | ||
one: biliard | ||
few: biliardy | ||
many: biliardów | ||
quintillion: | ||
one: trylion | ||
few: tryliony | ||
many: trylionów | ||
sextillions: | ||
one: tryliard | ||
few: tryliardy | ||
many: tryliardów | ||
septillions: | ||
one: sekstilion | ||
few: sekstiliony | ||
many: sekstilionów | ||
octillions: | ||
one: kvadriliarda | ||
few: kvadriliardy | ||
many: kvadriliard | ||
ordinal: | ||
ones: | ||
male: [zerowy, pierwszy, drugi, trzeci, czwarty, pięty, szósty, siódmy, ósmy, dziewiąty] | ||
female: [zerowa, pierwsza, druga, trzecia, czwarta, piąta, szósta, siódma, ósma, dziewiąta] | ||
neuter: [zerowe, pierwsze, drugie, trzecie, czwarte, piąte, szóste, siódme, ósme, dziewiąte] | ||
teens: | ||
male: [_, jedenasty, dwunasty, trzynasty, czternasty, piętnasty, szesnasty, siedemnasty, osiemnasty] | ||
female: [_, jedenasta, dwunasta, trzynasta, czternasta, piętnasta, szesnasta, siedemnasta, osiemnasta] | ||
neuter: [_, jedenaste, dwunaste, trzynaste, czternaste, piętnaste, szesnaste, siedemnaste, osiemnaste] | ||
tens: | ||
male: [_, dwudziesty, trzydziesty, czterdziesty, pięćdziesiąty, sześćdziesiąty, siedemdziesiąty, osiemdziesiąty, dziewięcdziesiąty] | ||
female: [_, dwudziesta, trzydziesta, czterdziesta, pięćdziesiąta, sześćdziesiąta, siedemdziesiąta, osiemdziesiąta, dziewięcdziesiąta] | ||
neuter: [_, dwudzieste, trzydzieste, czterdzieste, pięćdziesiąte, sześćdziesiąte, siedemdziesiąte, osiemdziesiąte, dziewięcdziesiąte] | ||
hundreds: | ||
male: [_, setny, dwusetny, trzysetny, czterysetny, pięćsetny, sześćsetny, siedemsetny, osiemsetny, dziewięćsetny] | ||
female: [_, setna, dwuseta, trzysetna, czterysetna, pięćsetna, sześćsetna, siedemsetna, osiemsetna, dziewięćsetna] | ||
neuter: [_, setne, dwusete, trzysetne, czterysetne, pięćsetne, sześćsetne, siedemsetne, osiemsetne, dziewięćsetne] | ||
integral: całych | ||
micro: [_, tenths, hundredths, thousandths, millionths, billionths, trillionths] | ||
tenths: | ||
one: dziesiętna | ||
few: dziesiętnych | ||
many: dziesiętnych | ||
hundredths: | ||
one: setna | ||
few: setnych | ||
many: setnych | ||
thousandths: | ||
one: tysięczna | ||
few: tysięcznych | ||
many: tysięcznych | ||
millionths: | ||
one: milionowa | ||
few: milionowych | ||
many: milionowych | ||
billionths: | ||
one: miliardowa | ||
few: miliardowych | ||
many: miliardowych | ||
trillionths: | ||
one: bilionowa | ||
few: bilionowych | ||
many: bilionowych | ||
micro_separator: '' | ||
micro_prefix: | ||
tens: dziesięć | ||
hundreds: sto | ||
union: '' | ||
union: 'i' |
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,38 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module I18n | ||
module Plurals | ||
module Pl | ||
module_function | ||
|
||
RULE = lambda do |number| | ||
if one_conditions(number) | ||
:one | ||
elsif few_conditions(number) | ||
:few | ||
elsif many_conditions(number) | ||
:many | ||
else | ||
:other | ||
end | ||
end | ||
|
||
def one_conditions(number) | ||
number % 10 == 1 && number % 100 != 11 | ||
end | ||
|
||
def few_conditions(number) | ||
[2, 3, 4].include?(number % 10) && | ||
![12, 13, 14].include?(number % 100) | ||
end | ||
|
||
def many_conditions(number) | ||
(number % 10).zero? || | ||
[5, 6, 7, 8, 9].include?(number % 10) || | ||
[11, 12, 13, 14].include?(number % 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
12 changes: 12 additions & 0 deletions
12
lib/numbers_and_words/strategies/array_joiner/languages/pl.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 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module Strategies | ||
module ArrayJoiner | ||
module Languages | ||
class Pl < 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
5 changes: 5 additions & 0 deletions
5
lib/numbers_and_words/strategies/figures_converter/decorators/pl.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,5 @@ | ||
# frozen_string_literal: true | ||
|
||
require 'numbers_and_words/strategies/figures_converter/decorators/pl/base' | ||
require 'numbers_and_words/strategies/figures_converter/decorators/pl/fractional' | ||
require 'numbers_and_words/strategies/figures_converter/decorators/pl/integral' |
14 changes: 14 additions & 0 deletions
14
lib/numbers_and_words/strategies/figures_converter/decorators/pl/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,14 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Pl | ||
class Base < Decorators::Base | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
40 changes: 40 additions & 0 deletions
40
lib/numbers_and_words/strategies/figures_converter/decorators/pl/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,40 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Pl | ||
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 |
31 changes: 31 additions & 0 deletions
31
lib/numbers_and_words/strategies/figures_converter/decorators/pl/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,31 @@ | ||
# frozen_string_literal: true | ||
|
||
module NumbersAndWords | ||
module Strategies | ||
module FiguresConverter | ||
module Decorators | ||
module Pl | ||
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.11.12 wasn't released, move your feature to the section below