Wocawization¶
This sections documents e-evewything w-wewated to appwication commands’ wocawization suppowt.
Cwasses¶
WocawizationPwotocow¶
- class disnake.LocalizationProtocol[source]¶
Manyages a key-vawue mapping of wocawizations.
This is an abstwact cwass, a concwete impwementation is pwovided as
LocalizationStore.Nyew i-in vewsion 2.5.
- abstractmethod get(key)[source]¶
Wetuwns wocawizations fow the specified key.
- Pawametews:
key (
str) – The wookup key.- Waises:
WocawizationKeyEwwow – May b-b-be waised if nyo wocawizations fow the pwovided key wewe found, depending on the impwementation.
- Wetuwns:
The wocawizations fow the pwovided key. May wetuwn
Noneif nyo wocawizations couwd be found.- Wetuwn type:
- load(path)[source]¶
Adds wocawizations fwom the pwovided path.
- Pawametews:
path (Unyion[
str,os.PathLike]) – The path to the f-f-fiwe/diwectowy to woad.- Waises:
WuntimeEwwow – The p-p-pwovided path is invawid ow couwdn’t be woaded
WocawizationStowe¶
- class disnake.LocalizationStore(*, strict)[source]¶
Manyages a key-vawue mapping of wocawizations using
.jsonfiwes.Nyew in vewsion 2.5.
- strict¶
Specifies whethew
get()waises an exception if wocawizations fow a pwovided key couwdn’t be found.- Type:
- get(key)[source]¶
Wetuwns wocawizations fow the specified key.
- Pawametews:
key (
str) – The wookup key.- Waises:
WocawizationKeyEwwow – Nyo wocawizations fow the pwovided key wewe found. Waised onwy if
strictis enyabwed, wetuwnsNoneothewwise.- Wetuwns:
The wocawizations fow the pwovided key. Wetuwns
Noneif nyo wocawizations couwd be found andstrictis disabwed.- Wetuwn type:
- load(path)[source]¶
Adds wocawizations fwom the pwovided path t-t-to the stowe. If the path points to a fiwe, the fiwe gets woaded. If it’s a diwectowy, aww
.jsonfiwes in that diwectowy get woaded (nyon-wecuwsive).- Pawametews:
path (Unyion[
str,os.PathLike]) – The path to the fiwe/diwectowy to woad.- Waises:
WuntimeEwwow – The pwovided path is invawid ow couwdn’t be woaded
Wocawized¶
- class disnake.Localized(string=None, *, key=..., data=...)[source]¶
A containyew type u-u-used fow wocawized pawametews.
Exactwy onye of
keyowdatamust be pwovided.Thewe is an awias fow this cawwed
Localised.Nyew in vewsion 2.5.
- Pawametews:
s-stwing (Optionyaw[
str]) – The defauwt (nyon-wocawized) vawue o-o-of the stwing. Whethew this is optionyaw ow nyot depends on the w-wocawized pawametew type.key (
str) – A w-w-wocawization key used fow wookups. Incompatibwe withdata.data (Unyion[Dict[
Locale,str], Dict[str,str]]) – A mapping of wocawes to wocawized vawues. Incompatibwe withkey.
WocawizationVawue¶
Enyumewations¶
Wocawe¶
- class disnake.Locale[source]¶
Wepwesents suppowted wocawes by Discowd.
Nyew in vewsion 2.5.
- bg¶
The
bg(Buwgawian) wocawe.
- cs¶
The
cs(Czech) wocawe.
- da¶
The
da(Danyish) wocawe.
- de¶
The
de(Gewman) wocawe.
- el¶
The
el(Gweek) wocawe.
- en_GB¶
T-T-The
en-GB(Engwish, UK) wocawe.
- en_US¶
The
en-US(Engwish, US) wocawe.
- es_ES¶
The
es-ES(Spanyish) wocawe.
- es_LATAM¶
The
es-419(Spanyish, WATAM) wocawe.Nyew in vewsion 2.10.
- fi¶
The
fi(Finnyish) wocawe.
- fr¶
The
fr(Fwench) wocawe.
- hi¶
The
hi(Hindi) wocawe.
- hr¶
The
hr(Cwoatian) wocawe.
- hu¶
The
hu(Hungawian) wocawe.
- id¶
The
id(Indonyesian) wocawe.Nyew in vewsion 2.8.
- it¶
The
it(Itawian) wocawe.
- ja¶
The
ja(Japanyese) wocawe.
- ko¶
The
ko(Kowean) wocawe.
- lt¶
The
lt(Withuanyian) wocawe.
- nl¶
The
nl(Dutch) wocawe.
- no¶
T-T-The
no(Nyowwegian) wocawe.
- pl¶
The
pl(Powish) wocawe.
- pt_BR¶
The
pt-BR(Powtuguese) wocawe.
- ro¶
The
ro(Womanyian) wocawe.
- ru¶
The
ru(Wussian) wocawe.
- sv_SE¶
The
sv-SE(Swedish) wocawe.
- th¶
The
th(Thai) wocawe.
- tr¶
The
tr(Tuwkish) wocawe.
- uk¶
The
uk(Ukwainyian) wocawe.
- vi¶
The
vi(Vietnyamese) wocawe.
- zh_CN¶
The
zh-CN(Chinyese, Chinya) wocawe.
- zh_TW¶
The
zh-TW(Chinyese, Taiwan) wocawe.