use translation list
This commit is contained in:
Родитель
a7d4038a9c
Коммит
5013075a43
|
@ -36,7 +36,7 @@ class VectorLayer(
|
|||
detachable={"elements"},
|
||||
speckle_type="Objects.GIS.VectorLayer",
|
||||
serialize_ignore={"features"},
|
||||
speckle_type_translations={"VectorLayer": "Objects.GIS.VectorLayer"},
|
||||
speckle_type_translations=["VectorLayer"],
|
||||
):
|
||||
|
||||
"""GIS Vector Layer"""
|
||||
|
@ -65,7 +65,7 @@ class RasterLayer(
|
|||
detachable={"elements"},
|
||||
speckle_type="Objects.GIS.RasterLayer",
|
||||
serialize_ignore={"features"},
|
||||
speckle_type_translations={"RasterLayer": "Objects.GIS.RasterLayer"},
|
||||
speckle_type_translations=["RasterLayer"],
|
||||
):
|
||||
|
||||
"""GIS Raster Layer"""
|
||||
|
|
|
@ -161,7 +161,7 @@ class _RegisteringBase:
|
|||
chunkable: Optional[Dict[str, int]] = None,
|
||||
detachable: Optional[Set[str]] = None,
|
||||
serialize_ignore: Optional[Set[str]] = None,
|
||||
speckle_type_translations: Optional[Dict[str, str]] = None,
|
||||
speckle_type_translations: Optional[List[str]] = None,
|
||||
**kwargs: Dict[str, Any],
|
||||
):
|
||||
"""
|
||||
|
@ -192,7 +192,9 @@ class _RegisteringBase:
|
|||
if serialize_ignore:
|
||||
cls._serialize_ignore = cls._serialize_ignore.union(serialize_ignore)
|
||||
if speckle_type_translations:
|
||||
cls._translations.update(speckle_type_translations)
|
||||
cls._translations.update(
|
||||
{trans: cls.speckle_type for trans in speckle_type_translations}
|
||||
)
|
||||
super().__init_subclass__(**kwargs)
|
||||
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ def test_translations() -> None:
|
|||
class TrickyToTranslate(
|
||||
Base,
|
||||
speckle_type=speckle_type_override,
|
||||
speckle_type_translations={translated_speckle_type: speckle_type_override},
|
||||
speckle_type_translations=[translated_speckle_type],
|
||||
):
|
||||
"""This is just a test class with no body."""
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче