pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
227 stars 53 forks source link

Website Localization #53

Closed mechcalvin closed 3 years ago

mechcalvin commented 5 years ago

finally sort out the problem and running on my website (require manual update for now), looks fantastic but wondering

  1. how to do translation on e.g. award titles, descriptions, etc
  2. does the awardlist order is auto arrange by names? so if i change the names it will re-arrange base on the new names?
pdinklag commented 5 years ago
  1. how to do translation on e.g. award titles, descriptions, etc

Currently, the only way to do this is by editing all the modules (the py files in the mcstats/stats directory). Simply change the title and desc fields to what you need.

The units for stats are practically hardcoded to be metric - if you need miles or want to change those, you'll have to change that in the client (the JavaScripts).

I never had localization in mind, but it sounds like a good idea to centralize it in language files similar to how Minecraft works itself. 👍

  1. does the awardlist order is auto arrange by names? so if i change the names it will re-arrange base on the new names?

Yes, the list should be sorted by the award title automatically.

pdinklag commented 3 years ago

Localization has been implemented! I have added a dropdown in the navigation that allows selecting the language, an example can be seen here: https://mine3.dvgaming.com/

At the time of writing, only English and my native language German are supported. Instructions for adding new languages are given in the readme - if you do translate MinecraftStats, please do create a pull request!

albancolley commented 2 years ago

Hi Patrick,

The localization tag for minutes is wrong in js/dev/mcstats-widgets.js. stat.unit.duration.hours should be stat.unit.duration.minutes

            if(higher || seconds > 60) {
                var minutes = Math.floor(seconds / 60);
                table += `<td class="minutes">${minutes}${**mcstats.localize('stat.unit.duration.hours**')}</td>`

                seconds %= 60;
            } else {
                table += `<td class="minutes"></td>`
            }