How to do Localization in FoundryVTT

Author: sparkcities
Message:

Is there a tutorial or resource on implementing localization properly? {{localize BLAH.blah }} is easy enough, but how do you get it to connect to the files in lang, where is that code

Author: vance

Message:

https://foundryvtt.com/article/localization/

Author: cswendrowski

Message:

You declare what Languages are available in your module.json

  "languages": [
    {
      "lang": "en",
      "name": "English",
      "path": "languages/en.json"
    },
    {
      "lang": "es",
      "name": "Spanish",
      "path": "languages/es.json"
  ],

Those files contain all of your keys with their translations

en.json

{
  "MyApp.hello": "Hello"
}

es.json

{
  "MyApp.hello": "Hola"
}

You just call the key you want in your app and Foundry takes care of the rest

{{ localize 'MyApp.Hello' }}
game.i18n.localize("MyApp.Hello")

Author: vance

Message:

https://discordapp.com/channels/170995199584108546/596018541879230476/606565117332553750