
Security News
Scaling Socket from Zero to 10,000+ Organizations
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.
oarepo-model-builder-multilingual
Advanced tools
plugin for the oarepo-model-builder module that adds support for multilingual data types
Within this plugin, two data types are added: multilingual and i18nstr. They can be added to the data model
using type: multilingual or type: i18nstr.
Values containing language tags must be in IETF format.
The structure of both data types can be changed using the multilingual field
An object that contains the language of the item and the actual value of the item.
"abstract": {"type": "i18nStr"}
"abstract": {
"type": "object",
"properties": {
"lang": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
Array of i18nStr objects.
"abstract": {"type": "multilingual"}
"abstract": {
"type": "array",
"items": {
"type": "object",
"properties": {
"lang": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
i18nstr can be added to another object using "use": "i18n".
Supported languages are defined in the object in the structure: "supported language tag": {object containing additional information} within the field supported-langs in model settings.
Supported languages definition is used to specify the languages to be indexed in elasticsearch and opensearch,
respectively. All supplied data for the supported language will be inserted into the mapping definition.
"model": {"properties": {"a": {"type": "multilingual"}}
"settings": {"supported-langs": {
"cs": {
"text": {
"analyzer": "czech",
},
"sort": {
"type": "icu_collation_keyword"
},
"keyword": {
"test": "test"
}
},
"en": {
"text": {
"analyzer": "en"
},
"sort": {
"type": "icu_collation_keyword"
}
}}}}
"mappings": {
"properties": {
"a": {
"type": "object",
"properties": {
"lang": {
"type": "keyword"
},
"value": {
"type": "text"
}
}
},
"a_cs": {
"type": "text",
"analyzer": "czech",
"sort": {
"type": "icu_collation_keyword",
"index": false,
"language": "cs"
},
"fields": {
"keyword": {
"test": "test",
"type": "keyword"
}
}
},
"a_en": {
"type": "text",
"analyzer": "en",
"sort": {
"type": "icu_collation_keyword",
"index": false,
"language": "en"
},
"fields": {
"keyword": {
"type": "keyword"
}
}
}
}
The name of the field for the language value and the name of the field for the value of the item itself can be changed
using the multilingual field and the value-field and lang-field fields. It is not required to rename both fields.
"b":{"type": "i18nStr", "multilingual":{"lang-field": "language", "value-field": "val"}}
class BSchema(ma.Schema, ):
"""BSchema schema."""
language = ma_fields.String()
val = ma_fields.String()
class TestSchema(ma.Schema, ):
"""TestSchema schema."""
b = ma_fields.Nested(lambda: BSchema())
If supported languages are defined, indexing for these languages can be added to data types other than multilingual and
i18nStr. For this purpose you need to add to the field: 'multilingual': {'i18n': True}
"model": {"properties": {"a": {"type": "fulltext", "multilingual": {"i18n": true}}}
"settings": {"supported-langs": {"cs": {}, "en": {}}}}
{"mappings":
{"properties":{
"a":{"type":"text"},
"a_cs":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":50}}},
"a_en":{"type":"text","fields":{"keyword":{"type":"keyword","ignore_above":50}}}}}}
FAQs
Unknown package
We found that oarepo-model-builder-multilingual demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh shares lessons from scaling a developer security startup to 10,000+ organizations in this founder interview.

Research
Socket Threat Research maps a rare inside look at OtterCookie’s npm-Vercel-GitHub chain, adding 197 malicious packages and evidence of North Korean operators.

Research
Socket researchers identified a malicious Chrome extension that manipulates Raydium swaps to inject an undisclosed SOL transfer, quietly routing fees to an attacker wallet.