-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dorian Sarnowski
committed
Jun 19, 2015
1 parent
ca0c071
commit c19da81
Showing
17 changed files
with
298 additions
and
25 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
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
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
23 changes: 23 additions & 0 deletions
23
...ain/java/pl/allegro/finance/tradukisto/internal/languages/english/EnglishPluralForms.java
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,23 @@ | ||
package pl.allegro.finance.tradukisto.internal.languages.english; | ||
|
||
import pl.allegro.finance.tradukisto.internal.languages.GenderType; | ||
import pl.allegro.finance.tradukisto.internal.languages.PluralForms; | ||
|
||
public class EnglishPluralForms implements PluralForms { | ||
|
||
private final String form; | ||
|
||
public EnglishPluralForms(String form) { | ||
this.form = form; | ||
} | ||
|
||
@Override | ||
public String formFor(Integer value) { | ||
return form; | ||
} | ||
|
||
@Override | ||
public GenderType genderType() { | ||
return GenderType.NON_APPLICABLE; | ||
} | ||
} |
76 changes: 76 additions & 0 deletions
76
src/main/java/pl/allegro/finance/tradukisto/internal/languages/english/EnglishValues.java
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,76 @@ | ||
package pl.allegro.finance.tradukisto.internal.languages.english; | ||
|
||
import pl.allegro.finance.tradukisto.internal.BaseValues; | ||
import pl.allegro.finance.tradukisto.internal.languages.GenderForms; | ||
import pl.allegro.finance.tradukisto.internal.languages.PluralForms; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import static pl.allegro.finance.tradukisto.internal.support.BaseNumbersBuilder.baseNumbersBuilder; | ||
|
||
public class EnglishValues implements BaseValues { | ||
|
||
@Override | ||
public Map<Integer, GenderForms> baseNumbers() { | ||
return baseNumbersBuilder() | ||
.put(0, "zero") | ||
.put(1, "one") | ||
.put(2, "two") | ||
.put(3, "three") | ||
.put(4, "four") | ||
.put(5, "five") | ||
.put(6, "six") | ||
.put(7, "seven") | ||
.put(8, "eight") | ||
.put(9, "nine") | ||
.put(10, "ten") | ||
.put(11, "eleven") | ||
.put(12, "twelve") | ||
.put(13, "thirteen") | ||
.put(14, "fourteen") | ||
.put(15, "fifteen") | ||
.put(16, "sixteen") | ||
.put(17, "seventeen") | ||
.put(18, "eighteen") | ||
.put(19, "nineteen") | ||
.put(20, "twenty") | ||
.put(30, "thirty") | ||
.put(40, "forty") | ||
.put(50, "fifty") | ||
.put(60, "sixty") | ||
.put(70, "seventy") | ||
.put(80, "eighty") | ||
.put(90, "ninety") | ||
.put(100, "one hundred") | ||
.put(200, "two hundred") | ||
.put(300, "three hundred") | ||
.put(400, "four hundred") | ||
.put(500, "five hundred") | ||
.put(600, "six hundred") | ||
.put(700, "seven hundred") | ||
.put(800, "eight hundred") | ||
.put(900, "nine hundred") | ||
.build(); | ||
} | ||
|
||
@Override | ||
public List<PluralForms> pluralForms() { | ||
return Arrays.<PluralForms>asList( | ||
new EnglishPluralForms(""), | ||
new EnglishPluralForms("thousand"), | ||
new EnglishPluralForms("million"), | ||
new EnglishPluralForms("bilion")); | ||
} | ||
|
||
@Override | ||
public String currency() { | ||
return "£"; | ||
} | ||
|
||
@Override | ||
public char twoDigitsNumberSeparator() { | ||
return '-'; | ||
} | ||
} |
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
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
15 changes: 15 additions & 0 deletions
15
...vy/pl/allegro/finance/tradukisto/internal/languages/english/EnglishPluralFormsTest.groovy
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,15 @@ | ||
package pl.allegro.finance.tradukisto.internal.languages.english | ||
import spock.lang.Specification | ||
|
||
class EnglishPluralFormsTest extends Specification { | ||
|
||
def pluralForms = new EnglishPluralForms("thousand") | ||
|
||
def "should provide value for singular form"() { | ||
expect: | ||
pluralForms.formFor(value) == "thousand" | ||
|
||
where: | ||
value << (0..100) | ||
} | ||
} |
Oops, something went wrong.