-
Notifications
You must be signed in to change notification settings - Fork 0
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
amatsegor
committed
Sep 20, 2018
1 parent
17e2228
commit a4f7516
Showing
8 changed files
with
168 additions
and
38 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
26 changes: 25 additions & 1 deletion
26
lokalize-common/src/main/kotlin/lokalize/models/LSPlural.kt
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,10 +1,34 @@ | ||
package lokalize.models | ||
|
||
class LSPlural(key: String, private val values: Map<String, String> = hashMapOf()): LSEntity(key) { | ||
class LSPlural(key: String, val values: MutableMap<String, String> = hashMapOf()) : LSEntity(key) { | ||
|
||
override val isEmpty: Boolean | ||
get() = values.isEmpty() | ||
|
||
override val isComment: Boolean | ||
get() = false | ||
|
||
operator fun plus(line: LSLine): LSPlural { | ||
values[line.key] = line.value | ||
return this | ||
} | ||
|
||
enum class Quantifier { | ||
ZERO, | ||
ONE, | ||
TWO, | ||
FEW, | ||
MANY, | ||
OTHER; | ||
|
||
companion object { | ||
fun isQuantifierValid(quantifier: String) = try { | ||
Quantifier.valueOf(quantifier.toUpperCase()) | ||
true | ||
} catch (e: IllegalArgumentException) { | ||
false | ||
} | ||
} | ||
|
||
} | ||
} |
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