donaldzou / WGDashboard

Simple dashboard for WireGuard VPN written in Python w/ Flask
Apache License 2.0
1.44k stars 212 forks source link

[Looking for help!] Localization of WGDashboard #397

Open donaldzou opened 3 hours ago

donaldzou commented 3 hours ago

Hi all, I finally finished adding the support of localization, and currently WGDashboard support the following languages:

I'm hoping if any of you are willing to contribute, you can follow the instructions below:

  1. Download the v4.1-dev branch
  2. Copy one of the existing locale .json file and rename them using the locale code in this list: https://www.science.co.il/language/Locale-codes.php
  3. The key is the matching what the dashboard have, so don't change it, and the value is the translation.
  4. Start translate ;)
  5. Add your translation to src/static/locale/active_languages.json by following the same format
  6. After you're done, create an PR to the v4.1-dev :)

You might notice there are some Regex syntax in the existing locale files. Basically, the dashboard will match the key to the texts in the UI, and replace the value using regex. So you can adjust the position of matching groups to better fit your language. For example: You can add up to (.*) peers have one matching group which is matching a number between to and peers, and you can use $1 in the value to represent the number.

Please comment below if you have any questions 😄

DaanSelen commented 3 hours ago

I can provide Dutch if you'd like, but how would I do that?

donaldzou commented 3 hours ago

I can provide Dutch if you'd like, but how would I do that?

Hi @DaanSelen, I provided an instruction above :) Is fairly easy as I already have an example in the v4.1-dev branch. Basically the file looks like this:

{
    "Welcome to": "歡迎來到",
    "Username": "用戶名",
    "Password": "密碼",
    "OTP from your authenticator": "您多重身份驗證器的一次性驗證碼",
    "Sign In": "登錄"
...
}

Where the key is what you translating from, and the value is what you are translating to. The example provided is Chinese (Traditional)

NOXCIS commented 40 minutes ago

@donaldzou I can do the Spanish & Portuguese bit.