Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAQ translations do not appear on the web page #14563

Closed
CuriousMagpie opened this issue Mar 29, 2023 · 8 comments · Fixed by #15079
Closed

FAQ translations do not appear on the web page #14563

CuriousMagpie opened this issue Mar 29, 2023 · 8 comments · Fixed by #15079

Comments

@CuriousMagpie
Copy link
Member

The FAQ page appears to only display English regardless of which language the user has the application set.

This was reported by a Ukrainian user who noticed on the Translate Habitica page that the FAQ was 100% translated into Ukrainian. I tested this with Ukrainian, French, Spanish, and Italian and had the same results. The headers and footers were in my selected language while the FAQ remained in English.

This may be related tangentially to #14246, but I cannot say for sure. I'm providing the link for full coverage of potential roadblocks in resolving this problem.

@yassine-bouassida
Copy link

Hey @CuriousMagpie ,

I noticed the issue with the FAQ page not displaying properly in different languages and was able to replicate the bug myself. I'd be happy to take a look at it and work on a fix. If you have any suggestions or advice, please let me know. I'm excited to contribute to the project and help resolve this issue.

@CuriousMagpie
Copy link
Member Author

@yassine-bouassida It's all yours and thank you so much! I wish I had some advice; we have an open issue to refactor the FAQ because of unnecessary complexity when needing to add/remove questions and looking at that issue and the referenced files may be helpful to trace the source of the bug.

@yassine-bouassida
Copy link

Hello, I would like to inform you that I am currently unable to continue working on this issue since I have been unsuccessful in setting up Habitica locally. Rather than keeping the issue blocked while I deal with the setup, I believe it would be best to proceed with a handover. First and foremost, I have confirmed that this issue only applies to the FAQ page, as I have checked all the other pages and they are functioning properly. Specifically, on the FAQ page, only the questions and answers are not being translated. However, the title and H1 tag, "frequentlyAskedQuestions," are being translated correctly.

I have a couple of suggestions to address this issue. Firstly, it would be worth checking if the file "website\client\src\components\static\faq.vue" is properly handling the FAQ line 99. Secondly, adding some logs in the file "website\common\script\content\faq.js" could provide additional insights, even though everything appears to be fine there. Lastly, I have verified that the FAQ JSON file in the locales directory is in good condition.

Please let me know if there is anything else I can assist you with.

@CuriousMagpie
Copy link
Member Author

@yassine-bouassida Thanks for letting us know, and for doing all that investigatory work--it is very much appreciated on our part!

@umbrella-h
Copy link
Contributor

@CuriousMagpie May I take a stab at this?

@CuriousMagpie
Copy link
Member Author

Absolutely, @umbrella-h!

@umbrella-h
Copy link
Contributor

Findings

While delving into the codebase, I discovered the following:

  1. The query parameter language is necessary for the FAQ API to respond in the language configured by the user.

    • a. /api/v4/faq GET
    • b. File paths in the codebase:
      • i. website/client/src/store/actions/faq.js
      • ii. website/server/controllers/api-v4/faq.js
  2. The comments in website/server/controllers/api-v4/faq.js lines 43-52 state:

    If the authenticated user makes the request, the content will return with the user's configured language.

Actions

  1. Submitted a PR to fix the FAQ translation problem; please review Fixes #14563 FAQ translations on the web page #15079 for details.
  2. Verified that the /api/v4/faq GET request is sent with headers x-api-user and x-api-key (in Firefox browser network tool). If this constitutes an 'authenticated user', I'm curious about the behavior implied by the comment description.

I sincerely apologize for the delayed response!!! Unfortunately, this issue got buried in my tasks until I started my year-end review. 🙇🏻‍♀️🙇🏻‍♀️🙇🏻‍♀️

@CuriousMagpie
Copy link
Member Author

Thanks so much for your work here, @umbrella-h! Your PR has been merged, so I'm going to go ahead and close this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants