web script i18n/check-i18n.js can not run any more #12247

Closed
opened 2026-02-21 19:06:33 -05:00 by yindo · 3 comments
Owner

Originally created by @kindy on GitHub (Mar 27, 2025).

Originally assigned to: @kindy, @crazywoola on GitHub.

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

sha: ea1d45942

Cloud or Self Hosted

Self Hosted (Source), Cloud

Steps to reproduce

  • use web UI
  • see some text is missing (billing.plansCommon.documentProcessingPriorityTip)
  • clone code and check source, seems en-US missing some key
  • find check-i18n.js, try to run it
  • fail
cd web
node i18n/check-i18n.js

✔️ Expected Behavior

check missing keys

Actual Behavior

throw error:

~dify/web/i18n/check-i18n.js:39
        const keys = Object.keys(translation);
                            ^

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at ~dify/web/i18n/check-i18n.js:39:29
    at Array.forEach (<anonymous>)
    at ~dify/web/i18n/check-i18n.js:23:13
    at FSReqCallback.oncomplete (node:fs:188:23)

Node.js v23.2.0
Originally created by @kindy on GitHub (Mar 27, 2025). Originally assigned to: @kindy, @crazywoola on GitHub. ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version sha: ea1d45942 ### Cloud or Self Hosted Self Hosted (Source), Cloud ### Steps to reproduce - use web UI - see some text is missing (`billing.plansCommon.documentProcessingPriorityTip`) - clone code and check source, seems en-US missing some key - find check-i18n.js, try to run it - fail ```sh cd web node i18n/check-i18n.js ``` ### ✔️ Expected Behavior check missing keys ### ❌ Actual Behavior throw error: ``` ~dify/web/i18n/check-i18n.js:39 const keys = Object.keys(translation); ^ TypeError: Cannot convert undefined or null to object at Function.keys (<anonymous>) at ~dify/web/i18n/check-i18n.js:39:29 at Array.forEach (<anonymous>) at ~dify/web/i18n/check-i18n.js:23:13 at FSReqCallback.oncomplete (node:fs:188:23) Node.js v23.2.0 ```
yindo added the 🐞 bug label 2026-02-21 19:06:33 -05:00
yindo closed this issue 2026-02-21 19:06:33 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 27, 2025):

Hello @kindy! I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let's work together to resolve the issue you're facing.

The error you're encountering with the i18n/check-i18n.js script is likely due to the script attempting to evaluate a file content that does not result in a valid object. Specifically, it seems that one of the translation files, such as web/i18n/en-US/register.ts, might be exporting an empty object or is missing the expected keys and values [1].

To resolve this issue, you should:

  1. Check the Translation Files: Ensure that all translation files in the en-US directory, including register.ts, are populated with the necessary keys and values. These files should contain key-value pairs where the key is a string identifier used in the application, and the value is the English translation of that string [2].

  2. Add Error Handling: Consider adding error handling around the eval statement in the script to catch and log any issues with specific files. This can help identify which files are causing the problem.

By ensuring that the translation files are correctly populated and adding error handling, you should be able to run the script without encountering the "TypeError: Cannot convert undefined or null to object" error.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

@dosubot[bot] commented on GitHub (Mar 27, 2025): <!-- Greeting --> Hello @kindy! I'm here to help you with any bugs, questions, or contributions you have for the Dify project. Let's work together to resolve the issue you're facing. <!-- Answer --> The error you're encountering with the `i18n/check-i18n.js` script is likely due to the script attempting to evaluate a file content that does not result in a valid object. Specifically, it seems that one of the translation files, such as `web/i18n/en-US/register.ts`, might be exporting an empty object or is missing the expected keys and values <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/i18n/check-i18n.js)</sup>. To resolve this issue, you should: 1. **Check the Translation Files**: Ensure that all translation files in the `en-US` directory, including `register.ts`, are populated with the necessary keys and values. These files should contain key-value pairs where the key is a string identifier used in the application, and the value is the English translation of that string <sup>[[2]](https://github.com/langgenius/dify/blob/main/web/i18n/README.md)</sup>. 2. **Add Error Handling**: Consider adding error handling around the `eval` statement in the script to catch and log any issues with specific files. This can help identify which files are causing the problem. By ensuring that the translation files are correctly populated and adding error handling, you should be able to run the script without encountering the "TypeError: Cannot convert undefined or null to object" error. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/ae07942c-5622-4637-8bf5-4e62838b2ca2?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/ae07942c-5622-4637-8bf5-4e62838b2ca2?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/ae07942c-5622-4637-8bf5-4e62838b2ca2?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/ae07942c-5622-4637-8bf5-4e62838b2ca2?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ae07942c-5622-4637-8bf5-4e62838b2ca2?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/ae07942c-5622-4637-8bf5-4e62838b2ca2?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ae07942c-5622-4637-8bf5-4e62838b2ca2?feedback_type=other)</sup>
Author
Owner

@kindy commented on GitHub (Mar 27, 2025):

I'll open a PR to fix it.

  • make it works again
  • check all languages, not only based-on en-US

cc @crazywoola

@kindy commented on GitHub (Mar 27, 2025): I'll open a PR to fix it. - [ ] make it works again - [x] check all languages, not only based-on en-US cc @crazywoola
Author
Owner

@crazywoola commented on GitHub (Mar 27, 2025):

Thanks, feel free to open a PR

@crazywoola commented on GitHub (Mar 27, 2025): Thanks, feel free to open a PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#12247