Configuration
All package configuration lives under a single WeglotTranslations section, in appsettings.json or any other standard .NET configuration source (appsettings.{Environment}.json, user secrets, environment variables, your host's app settings):
json
{
"WeglotTranslations": {
"WeglotApiKey": "wg_your_api_key",
"CacheDurationInSeconds": 60,
"LicenseKey": "your licence key"
}
}| Setting | Default | Description |
|---|---|---|
WeglotApiKey | (empty) | Your Weglot API key. Required for translation to happen. See Setting up with Weglot for where to find it. |
CacheDurationInSeconds | 60 | How long a translated page is cached before it's translated again. Set to 0 to disable caching, so every request calls the Weglot API. See Caching. |
LicenseKey | (empty) | Your licence key, pasted as-is. Not needed on localhost. See Licence key. |
Configured languages, their URL prefixes and their display names are not configured here. They're stored in your site's database and managed from the backoffice. See Managing languages.
Note
WeglotApiKey, CacheDurationInSeconds and LicenseKey are read once at startup, so changing any of them requires an application restart. Language changes made in the backoffice take effect on the very next request, with no restart needed.