Merge pull request #1027 from wallace11/add-hebrew

Add hebrew document language
This commit is contained in:
eikek 2021-08-24 18:45:20 +02:00 committed by GitHub
commit 3bdc9477ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 47 additions and 2 deletions

View File

@ -30,6 +30,7 @@ RUN JDKPKG="openjdk11"; \
tesseract-ocr-data-ron \ tesseract-ocr-data-ron \
tesseract-ocr-data-lav \ tesseract-ocr-data-lav \
tesseract-ocr-data-jpn \ tesseract-ocr-data-jpn \
tesseract-ocr-data-heb \
unpaper \ unpaper \
wkhtmltopdf \ wkhtmltopdf \
libreoffice \ libreoffice \

View File

@ -102,6 +102,7 @@ object DateFind {
case Language.Dutch => dmy.or(ymd).or(mdy) case Language.Dutch => dmy.or(ymd).or(mdy)
case Language.Latvian => dmy.or(lavLong).or(ymd) case Language.Latvian => dmy.or(lavLong).or(ymd)
case Language.Japanese => ymd case Language.Japanese => ymd
case Language.Hebrew => dmy
} }
p.read(parts) match { p.read(parts) match {
case Result.Success(sds, _) => case Result.Success(sds, _) =>

View File

@ -52,6 +52,8 @@ object MonthName {
latvian latvian
case Language.Japanese => case Language.Japanese =>
japanese japanese
case Language.Hebrew =>
hebrew
} }
private val numbers = List( private val numbers = List(
@ -307,4 +309,19 @@ object MonthName {
List("11", "十一"), List("11", "十一"),
List("12", "十二") List("12", "十二")
) )
private val hebrew = List(
List("1", "ינואר"),
List("2", "פברואר"),
List("3", "מרץ"),
List("4", "אפריל"),
List("5", "מאי"),
List("6", "יוני"),
List("7", "יולי"),
List("8", "אוגוסט"),
List("9", "ספטמבר"),
List("10", "אוקטובר"),
List("11", "נובמבר"),
List("12", "דצמבר")
)
} }

View File

@ -113,6 +113,11 @@ object Language {
val iso3 = "jpn" val iso3 = "jpn"
} }
case object Hebrew extends Language {
val iso2 = "he"
val iso3 = "heb"
}
val all: List[Language] = val all: List[Language] =
List( List(
German, German,
@ -130,7 +135,8 @@ object Language {
Russian, Russian,
Romanian, Romanian,
Latvian, Latvian,
Japanese Japanese,
Hebrew
) )
def fromString(str: String): Either[String, Language] = { def fromString(str: String): Either[String, Language] = {

View File

@ -114,7 +114,13 @@ object SolrSetup {
"Add japanese content field", "Add japanese content field",
addContentField(Language.Japanese) addContentField(Language.Japanese)
), ),
SolrMigration.reIndexAll(15, "Re-Index after adding japanese content field") SolrMigration.reIndexAll(15, "Re-Index after adding japanese content field"),
SolrMigration[F](
16,
"Add hebrew content field",
addContentField(Language.Hebrew)
),
SolrMigration.reIndexAll(17, "Re-Index after adding hebrew content field")
) )
def addFolderField: F[Unit] = def addFolderField: F[Unit] =

View File

@ -30,6 +30,7 @@ type Language
| Dutch | Dutch
| Latvian | Latvian
| Japanese | Japanese
| Hebrew
fromString : String -> Maybe Language fromString : String -> Maybe Language
@ -82,6 +83,9 @@ fromString str =
else if str == "jpn" || str == "ja" || str == "japanese" then else if str == "jpn" || str == "ja" || str == "japanese" then
Just Japanese Just Japanese
else if str == "heb" || str == "he" || str == "hebrew" then
Just Hebrew
else else
Nothing Nothing
@ -137,6 +141,9 @@ toIso3 lang =
Japanese -> Japanese ->
"jpn" "jpn"
Hebrew ->
"heb"
all : List Language all : List Language
all = all =
@ -156,4 +163,5 @@ all =
, Romanian , Romanian
, Latvian , Latvian
, Japanese , Japanese
, Hebrew
] ]

View File

@ -64,6 +64,9 @@ gb lang =
Japanese -> Japanese ->
"Japanese" "Japanese"
Hebrew ->
"Hebrew"
de : Language -> String de : Language -> String
de lang = de lang =
@ -115,3 +118,6 @@ de lang =
Japanese -> Japanese ->
"Japanisch" "Japanisch"
Hebrew ->
"Hebräisch"