mirror of
https://github.com/langgenius/dify.git
synced 2025-07-11 19:23:10 +00:00
22 lines
450 B
Python
22 lines
450 B
Python
![]() |
from typing import Optional
|
||
|
|
||
|
from pydantic import BaseModel
|
||
|
|
||
|
|
||
|
class I18nObject(BaseModel):
|
||
|
"""
|
||
|
Model class for i18n object.
|
||
|
"""
|
||
|
zh_Hans: Optional[str] = None
|
||
|
en_US: str
|
||
|
|
||
|
def __init__(self, **data):
|
||
|
super().__init__(**data)
|
||
|
if not self.zh_Hans:
|
||
|
self.zh_Hans = self.en_US
|
||
|
|
||
|
def to_dict(self) -> dict:
|
||
|
return {
|
||
|
'zh_Hans': self.zh_Hans,
|
||
|
'en_US': self.en_US,
|
||
|
}
|