Skip to content

Commit 7b77c55

Browse files
committed
feat: add locale to gooddata-sdk
jira: CQ-1650 risk: low
1 parent 898c8fd commit 7b77c55

File tree

2 files changed

+25
-0
lines changed
  • packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace

2 files changed

+25
-0
lines changed

packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/declarative_model/workspace/logical_model/dataset/dataset.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class CatalogDeclarativeAttribute(Base):
7777
description: Optional[str] = None
7878
tags: Optional[list[str]] = None
7979
is_hidden: Optional[bool] = None
80+
locale: Optional[str] = None
8081

8182
@staticmethod
8283
def client_class() -> type[DeclarativeAttribute]:
@@ -143,6 +144,16 @@ def client_class() -> type[DeclarativeDatasetSql]:
143144
return DeclarativeDatasetSql
144145

145146

147+
@attr.s(auto_attribs=True, kw_only=True)
148+
class DeclarativeLabelTranslation(Base):
149+
locale: str
150+
source_column: str
151+
152+
@staticmethod
153+
def client_class() -> type[DeclarativeLabelTranslation]:
154+
return DeclarativeLabelTranslation
155+
156+
146157
@attr.s(auto_attribs=True, kw_only=True)
147158
class CatalogDeclarativeLabel(Base):
148159
id: str
@@ -153,6 +164,8 @@ class CatalogDeclarativeLabel(Base):
153164
tags: Optional[list[str]] = None
154165
value_type: Optional[str] = None
155166
is_hidden: Optional[bool] = None
167+
locale: Optional[str] = None
168+
translations: Optional[list[DeclarativeLabelTranslation]] = None
156169

157170
@staticmethod
158171
def client_class() -> type[DeclarativeLabel]:

packages/gooddata-sdk/src/gooddata_sdk/catalog/workspace/entity_model/content_objects/dataset.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@ def value_type(self) -> bool:
3636
def is_hidden(self) -> Optional[bool]:
3737
return safeget(self.json_api_attributes, ["isHidden"])
3838

39+
@property
40+
def locale(self) -> Optional[str]:
41+
return safeget(self.json_api_attributes, ["locale"])
42+
43+
@property
44+
def translations(self) -> Optional[list[dict[str, str]]]:
45+
return safeget(self.json_api_attributes, ["translations"])
46+
3947
def as_computable(self) -> Attribute:
4048
return Attribute(local_id=self.id, label=self.id)
4149

@@ -73,6 +81,10 @@ def granularity(self) -> Union[str, None]:
7381
def is_hidden(self) -> Optional[bool]:
7482
return safeget(self.json_api_attributes, ["isHidden"])
7583

84+
@property
85+
def locale(self) -> Optional[bool]:
86+
return safeget(self.json_api_attributes, ["locale"])
87+
7688
def primary_label(self) -> Union[CatalogLabel, None]:
7789
# use cast as mypy is not applying next, it claims, type is filter[CatalogLabel]
7890
return cast(Union[CatalogLabel, None], next(filter(lambda x: x.primary, self.labels), None))

0 commit comments

Comments
 (0)