@@ -102,16 +102,22 @@ matched on by API clients that care about the specific error condition.
102102
103103` error-messages.json ` is a server-side concern; the UI has a separate, independent localization
104104path built on the same ` errortextkey ` . ` ui/src/utils/plugins.js ` 's ` localeErrorUtilPlugin `
105- (` $toLocaleError(msg, key, params) ` ) looks up ` key ` (the ` errortextkey ` ) in the current locale's
106- i18n bundle (` ui/public/locales/<locale>.json ` , e.g. ` hi.json ` , ` fr_FR.json ` : flat key/value
107- maps, same ones used for every other UI string). If a matching entry exists, it's used instead of
108- the server-rendered ` errortext ` , with ` {{placeholder}} ` tokens substituted from ` errormetadata ` ;
109- otherwise it falls back to ` errortext ` unchanged. See ` ui/src/utils/plugins.js:230 ` for the call
110- site (` plugins.js:627 ` for the implementation).
105+ (` $toLocaleError(msg, key, params) ` , called from both ` $pollJob ` 's async job failure handling and
106+ ` $notifyError ` ) looks up ` key ` (the ` errortextkey ` ) in the current locale's i18n bundle
107+ (` ui/public/locales/<locale>.json ` , e.g. ` hi.json ` , ` fr_FR.json ` : flat key/value maps, same ones
108+ used for every other UI string). If a matching entry exists, it's used instead of the
109+ server-rendered ` errortext ` , with ` {{placeholder}} ` tokens substituted from ` errormetadata ` ;
110+ otherwise it falls back to ` errortext ` unchanged.
111+
112+ ** Admin variant** : like the server, before trying the base key, ` $toLocaleError ` first tries
113+ ` <key>.admin ` when the current user is a root admin (` roletype === 'Admin' ` ), falling back to the
114+ base key if no such entry exists. Only this root-admin case is special-cased, matching
115+ ` error-messages.json ` 's own ` .admin ` -suffix behavior; there's no equivalent variant for resource
116+ admins, domain admins, or regular users.
111117
112118Practically: to ship a UI-side translation for a specific error, add a key equal to its
113- ` errortextkey ` to the relevant locale file (e.g. ` ui/public/locales/hi.json ` for Hindi). No
114- server-side change is needed.
119+ ` errortextkey ` (optionally suffixed ` .admin ` for a root-admin-specific variant) to the relevant
120+ locale file (e.g. ` ui/public/locales/hi.json ` for Hindi). No server-side change is needed.
115121
116122## Global settings
117123
0 commit comments