UMB-CS682-Team-02 / tracker

0 stars 1 forks source link

Enable Translations for Roundup #38

Closed ashrith-UMB closed 6 months ago

ashrith-UMB commented 7 months ago

Objective: translating chart's labels to the user's chosen language.

All of you are running roundup-server from the development repository. If you were running from a release package, the translation files would have been built and installed.

To see a translated interface in the development repository, you need some files to compile the translations. Since you may not have them, we will use the method to install a translation file into your tracker. To do this:

Create a subdirectory 'locale' in your tracker home. It should be at the same level as 'config.ini'.

Copy the file 'de.po' from the locale subdirectory of your roundup repo to the 'locale' directory you created above.

To test the German translation file you installed, append the term:

@language=de

to the URL you use to access your demo tracker. If the URL doesn't include a '?', append a '?' and the term above. If the URL does include a '?', add an '&' and the term above to the end of your URL.

If you look in the locale directory, you should see the .po file you copied in and a .mo file generated by Roundup. The .mo file is a binary compiled version of the .po file. It is optimized for quickly looking up translations.

If you have done this correctly, you should see the interface translated into German. If you don't see the translated interface when loading the URL with '@language=de', try restarting roundup-server. It shouldn't be needed but I am not sure how VSCode may play with Roundup.

Appending '@language=de' sets a cookie in your browser that Roundup reads to determine the output language. To return to English, you can append:

@language=none

to enable the default language (English) for the tracker. You can also remove the cookie (I think it has the word "lang" in it's name) using your browser's developer tools.

rouilj commented 7 months ago

This is the first step to enabling translations on the chart. The goal of this ticket is to enable translations in Roundup's index and other pages.

Translating it on the chart will be a separate issue.

ashrith-UMB commented 6 months ago

Added locale folder and de.po file and translation working as expected for the index page. https://github.com/UMB-CS682-Team-02/tracker/commit/7668a6c003a748cc4d220a5aa094a0ec798da908

@Pratik0116 @varshi-123 Please pull the test branch to get the locale folder and use the following url as a reference for changing the language: http://localhost:8080/demo/?@language=de

To reset it back to English, use the following: http://localhost:8080/demo/?@language=none

ashrith-UMB commented 6 months ago

Working as expected (able to change language to German in index and other pages) Commit: https://github.com/UMB-CS682-Team-02/tracker/commit/7668a6c003a748cc4d220a5aa094a0ec798da908