dify icon indicating copy to clipboard operation
dify copied to clipboard

i18n objects not showing for tools

Open AndyMik90 opened this issue 1 year ago • 3 comments

Self Checks

  • [X] I have searched for existing issues search for existing issues, including closed ones.
  • [X] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [X] Pleas do not modify this template :) and fill in all the required fields.

Dify version

0.5.9

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

When changing the language from English to Portogues, the tools that have translations in their .yaml files are not showing the translated strings in the frontend.

For instance the Github Tool has pt_BR translated text, but it's showing english. CleanShot 2024-03-13 at 20 22 21@2x This is also true for other languages added, so there seems to be a logic that is not pulling the correct i18n objects.

✔️ Expected Behavior

If the tools have translations, the translated strings should show up in the frontend

❌ Actual Behavior

Seems to use fallback english strings for some of the labels/descriptions.

AndyMik90 avatar Mar 13 '24 19:03 AndyMik90

Hey there @AndyMik90! Great to see you diving into another challenge. Hope you're doing fantastic!

Based on the information you've provided, it seems like there might be an issue with how the i18n objects are being loaded or applied in the frontend. This could be due to a variety of reasons, such as incorrect file format, incorrect file naming, or issues with the logic that applies the translations.

Firstly, you mentioned that the translations are in .yaml files. However, the context provided shows that the translation file is named with a .ts extension (web/i18n/pt-BR/common.ts), which is typically used for TypeScript files. If the system is set up to specifically look for .yaml files for translations, it will not load translations from a .ts file, leading to the issue described.

To resolve this issue, ensure that the translations are placed in the correct file format as expected by the Dify version 0.5.9 and that the system is correctly configured to load translations from that format. If .yaml files are indeed required, the translations should be moved to a .yaml file, or the system configuration should be updated to load translations from .ts files if that's supported.

Secondly, the structure of the .yaml translation files and the i18n object in the Dify codebase could also be a factor. The .yaml files should include sections for identity, description, and parameters, each with their own localized labels and descriptions. The i18n object, on the other hand, should include fields for title, desc, and href, each with localized strings for different languages. If there are discrepancies between the structure of the .yaml files and the i18n object, this could lead to issues with loading or applying the translations.

Lastly, the logic that loads and applies the translations could be at fault. The Dify application uses the i18next library in combination with react-i18next to load and apply translations from .yaml files. If there are issues with the configuration of i18next, such as incorrect language codes or fallback languages, this could lead to the problem you're experiencing.

Unfortunately, without more information or access to the codebase, it's difficult to pinpoint the exact cause of the issue. If possible, could you provide more details about the structure of your .yaml files, the configuration of i18next, or any error messages you're seeing in the console? This would help in diagnosing and resolving the issue.

Sources

About Dosu

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Mar 13 '24 19:03 dosubot[bot]

We haven't covered this part yet. Currently we are offering basic language support the the whole application. But tools' data comes from backend yaml files. I am still looking for a convenient way to do this.

crazywoola avatar Mar 14 '24 02:03 crazywoola

Close due to it's no longer active, if you have any questions, you can reopen it.

github-actions[bot] avatar Mar 29 '24 03:03 github-actions[bot]