dosubot[bot] commented on issue #29509: URL: https://github.com/apache/superset/issues/29509#issuecomment-2212511050
<!-- Greeting --> Hey, @CodeWithEmad! I'm here to assist you with your issue. Let's work together to figure this out! 🤖 <!-- Answer --> The error `TypeError: Cannot read properties of null (reading 'domain')` typically occurs when the language pack JSON file is missing or not properly loaded, or if the structure of the language pack JSON file is incorrect or incomplete. Here are the steps to ensure your Persian language pack is correctly set up: 1. **Check the Structure of the Language Pack:** Ensure that the `fa` language pack JSON file includes the `domain` property and follows the correct structure. Here is an example of the correct structure: ```json { "domain": "superset", "locale_data": { "superset": { "": { "domain": "superset", "lang": "fa", "plural_forms": "nplurals=2; plural=(n != 1);" }, "Hello": ["سلام"], "You have %d message": ["شما %d پیام دارید", "شما %d پیام دارید"] } } } ``` 2. **Update the `Locale` Type:** Ensure that the `Locale` type in the frontend code includes the new language code. Update the `Locale` type as follows: ```ts export type Locale = | 'de' | 'en' | 'es' | 'fr' | 'it' | 'ja' | 'ko' | 'pt' | 'pt_BR' | 'ru' | 'zh' | 'fa'; // added Persian to supported locales in Superset ``` 3. **Add the Language Pack to the Frontend:** Ensure that the Persian language pack is properly added to the frontend. You can do this by adding the language pack JSON file to the appropriate directory and ensuring it is loaded correctly. 4. **Enable Language Selection:** Ensure that the `LANGUAGES` variable in your `superset_config.py` is correctly set up: ```python LANGUAGES = { "en": {"flag": "us", "name": "English"}, "fr": {"flag": "fr", "name": "French"}, "fa": {"flag": "ir", "name": "Persian"}, } ``` 5. **Build and Compile Translations:** After making the necessary changes, rebuild and compile the translations: ```bash npm run build-translation pybabel compile -d superset/translations ``` By following these steps, you should be able to resolve the `TypeError: Cannot read properties of null (reading 'domain')` error and successfully add Persian language support to the Superset frontend <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/translation/types/jed.ts)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/src/translation/types/index.ts)</sup><sup>[[3]](https://github.com/apache/superset/blob/master/superset/translations/empty_language_pack.json)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org For additional commands, e-mail: notifications-h...@superset.apache.org