mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-08 22:56:06 +00:00
Pluralize common variant unit names
This adds the most popular unit names as singular and plural to our locale for translation. The added Javascript performs a reverse lookup to find the right singular/plural form of a unit name in that language.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
describe "OptionValueNamer", ->
|
||||
subject = null
|
||||
|
||||
beforeEach ->
|
||||
module('admin.products')
|
||||
inject (_OptionValueNamer_) ->
|
||||
subject = new _OptionValueNamer_
|
||||
|
||||
describe "pluralize a variant unit name", ->
|
||||
it "returns the same word if no plural is known", ->
|
||||
expect(subject.pluralize("foo", 2)).toEqual "foo"
|
||||
|
||||
it "returns the same word if we omit the quantity", ->
|
||||
expect(subject.pluralize("loaf")).toEqual "loaf"
|
||||
|
||||
it "finds the plural of a word", ->
|
||||
expect(subject.pluralize("loaf", 2)).toEqual "loaves"
|
||||
|
||||
it "finds the singular of a word", ->
|
||||
expect(subject.pluralize("loaves", 1)).toEqual "loaf"
|
||||
|
||||
it "finds the zero form of a word", ->
|
||||
expect(subject.pluralize("loaf", 0)).toEqual "loaves"
|
||||
|
||||
it "ignores upper case", ->
|
||||
expect(subject.pluralize("Loaf", 2)).toEqual "loaves"
|
||||
Reference in New Issue
Block a user