{"record":{"id":"9061ef3a9f0751a5","repo":"pinpoint-apm/pinpoint","slug":"unsupported-locale-localekey","errorCode":null,"errorMessage":"Unsupported locale: ${localeKey}","messagePattern":"Unsupported locale: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"web-frontend/src/main/v3/packages/datetime-picker/src/utils/locale.ts","lineNumber":96,"sourceCode":"              return result + ' 후';\n            } else {\n              return result + ' 전';\n            }\n          }\n\n          return result;\n        },\n      };\n    case 'ja':\n      return {\n        ...ja,\n      };\n    case 'zh':\n      return {\n        ...zhCN,\n      };\n    default:\n      throw new Error(`Unsupported locale: ${localeKey}`);\n  }\n};\n","sourceCodeStart":78,"sourceCodeEnd":99,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/web-frontend/src/main/v3/packages/datetime-picker/src/utils/locale.ts#L78-L99","documentation":"getLocale maps a locale key (e.g. 'en','ko','zh') to a locale object. The switch's default branch throws 'Unsupported locale: <localeKey>' when the requested locale has no registered translation, so consumers never get a partially-localized picker.","triggerScenarios":"Calling getLocale('fr') (or any key not handled in the switch) or passing an undefined/null localeKey that is not one of the registered cases.","commonSituations":"Locale detected from navigator.language returning e.g. 'pt-BR' instead of a bare code, a new locale added to the app but not to this package, or a typo like 'zh-cn' vs 'zh'.","solutions":["Pass only supported locale keys; map/strip the browser locale to a supported one first","Add a new case to the switch for the needed locale","Provide a fallback in the caller (catch and use 'en')","Log the raw localeKey to confirm what actually arrived"],"exampleFix":"// before\nconst locale = getLocale(navigator.language); // 'pt-BR'\n// after\nconst key = navigator.language.slice(0, 2);\nconst locale = ['en','ko','zh'].includes(key) ? getLocale(key) : getLocale('en');","handlingStrategy":"fallback","validationCode":"const SUPPORTED_LOCALES = ['en','ko','zh'];\nconst key = String(localeKey ?? '').slice(0, 2);\nif (!SUPPORTED_LOCALES.includes(key)) localeKey = 'en';","typeGuard":null,"tryCatchPattern":"let locale;\ntry { locale = getLocale(key); } catch { locale = getLocale('en'); }","preventionTips":["Normalize navigator.language to its 2-letter base code","Maintain a single SUPPORTED_LOCALES constant shared with UI dropdowns","Always provide an English/default fallback path","Add a CI check that every shipped locale has a getLocale case"],"tags":["i18n","locale","invalid-argument"],"backgroundTag":"unsupported-enum-value","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}