decred / dcrweb

Decred website code.
37 stars 75 forks source link

wallets: Make link labels translatable #1154

Open xaur opened 8 months ago

xaur commented 8 months ago

Currently link labels at https://decred.org/wallets/ are hardcoded in the wallets.yml file and cannot be translated, e.g. see https://decred.org/zh/wallets/

An idea how it could work is change wallets.yml to reference label keys from transifex_catalogs/en.json and move English strings to the latter. wallets.yml would change from:

  links:
    - title: Download and release notes
      url: https://github.com/crypto-power/cryptopower/releases/tag/release-v1.0.0
    - title: Website
      url: https://cryptopower.dev

to

  links:
    - label_key: wallets_cryptopower_release
      url: https://github.com/crypto-power/cryptopower/releases/tag/release-v1.0.0
    - label_key: wallets_cryptopower_website
      url: https://cryptopower.dev

and en.json would gain keys like:

{
  "wallets_cryptopower_release": "Download and release notes",
  "wallets_cryptopower_website": "Website"
}

@jholdstock is this feasible in Hugo?

jholdstock commented 8 months ago

Yep. We would need to change title in wallets.yml to match a key in en.json. For example...

wallets.yml

  links:
    - string_id: cryptopower-release
      url: https://github.com/crypto-power/cryptopower/releases/tag/release-v1.0.0
    - string_id: cryptopower-website
      url: https://cryptopower.dev

en.json

"cryptopower-release" "Download and release notes",
"cryptopower-website": "Website",