Get fallback text from English
(self, key_path: str, **kwargs)
| 114 | return key_path |
| 115 | |
| 116 | def _get_fallback_text(self, key_path: str, **kwargs) -> str: |
| 117 | """Get fallback text from English""" |
| 118 | try: |
| 119 | lang_data = self.languages.get("en_US", {}) |
| 120 | keys = key_path.split('.') |
| 121 | value = lang_data |
| 122 | |
| 123 | for key in keys: |
| 124 | if isinstance(value, dict) and key in value: |
| 125 | value = value[key] |
| 126 | else: |
| 127 | return key_path |
| 128 | |
| 129 | if isinstance(value, str) and kwargs: |
| 130 | try: |
| 131 | return value.format(**kwargs) |
| 132 | except KeyError: |
| 133 | return value |
| 134 | |
| 135 | return str(value) |
| 136 | |
| 137 | except Exception: |
| 138 | return key_path |
| 139 | |
| 140 | def get_language_display_name(self, language_code: str = None) -> str: |
| 141 | """Get display name for language""" |