This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from lsafer-meemer/main
refactor: updated i18n support 2
- Loading branch information
Showing
4 changed files
with
33 additions
and
12 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,19 @@ | ||
package org.cufy.bson | ||
|
||
/** | ||
* A data class encapsulated an element with its language. | ||
*/ | ||
data class Localized<T>( | ||
val element: T, | ||
val lang: String, | ||
) | ||
|
||
/** | ||
* Return a string derived from this one with | ||
* its content tagged with the given language [tag]. | ||
*/ | ||
@BsonKeywordMarker | ||
infix fun String.lang(tag: String): String { | ||
if (tag.isEmpty()) return this | ||
return "$this#$tag" | ||
} |
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