{"record":{"id":"d8c455c8d96379b0","repo":"badges/shields","slug":"unsupported-language","errorCode":null,"errorMessage":"Unsupported language","messagePattern":"Unsupported language","errorType":"exception","errorClass":"InvalidResponse","httpStatus":null,"severity":"error","filePath":"services/localizely/localizely.service.js","lineNumber":137,"sourceCode":"      url: `https://api.localizely.com/v1/projects/${projectId}/status`,\n      options: {\n        searchParams: { branch },\n        headers: { 'X-Api-Token': apiToken },\n      },\n      httpErrors: {\n        403: 'not authorized for project',\n      },\n    })\n  }\n\n  static transform(json, languageCode) {\n    if (!languageCode) {\n      return { reviewedProgress: json.reviewedProgress }\n    }\n\n    const language = json.languages.find(lang => lang.langCode === languageCode)\n    if (!language) {\n      throw new InvalidResponse({ prettyMessage: 'Unsupported language' })\n    }\n\n    const { langName, reviewedProgress } = language\n\n    return { langName, reviewedProgress }\n  }\n\n  async handle({ projectId, branch }, { token: apiToken, languageCode }) {\n    const json = await this.fetch({ projectId, branch, apiToken })\n    const { langName, reviewedProgress } = this.constructor.transform(\n      json,\n      languageCode,\n    )\n\n    return this.constructor.render({ langName, reviewedProgress })\n  }\n}\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/badges/shields/blob/766fd8bc89a90b8534dc573ab72dec30215ab1ec/services/localizely/localizely.service.js#L119-L155","documentation":"The Localizely service fetches project statistics containing a per-language breakdown. When transforming the response, it looks up the requested language code in json.languages; if no language object matches the requested langCode, it throws InvalidResponse('Unsupported language') because the upstream API returned no data for that language.","triggerScenarios":"Requesting a badge for a language code that does not exist in the Localizely project's language list, so json.languages.find(lang => lang.langCode === languageCode) returns undefined.","commonSituations":"Typos or wrong casing in the language code (e.g. 'EN' vs 'en'), the language having been deleted from the Localizely project, or requesting a language never configured in the project.","solutions":["Check the language code in the badge URL against the languages actually configured in your Localizely project.","Use the exact langCode casing/format Localizely reports (e.g. 'en-US').","Add the missing language to the Localizely project if you need a badge for it."],"exampleFix":"// before\n/localizely/reviewed-progress/myproject/EN.svg\n// after\n/localizely/reviewed-progress/myproject/en-US.svg","handlingStrategy":"validation","validationCode":"const knownLangs = ['en-US','de-DE','fr-FR'] // from Localizely project settings\nif (!knownLangs.includes(languageCode)) throw new Error(`Language ${languageCode} not configured in Localizely project`)","typeGuard":"const isSupportedLanguage = (json, code) =>\n  typeof code === 'string' && Array.isArray(json?.languages) && json.languages.some(l => l.langCode === code)","tryCatchPattern":"try {\n  return await service.transform(json, languageCode)\n} catch (e) {\n  if (e instanceof InvalidResponse && e.prettyMessage === 'Unsupported language') {\n    // fall back to overall reviewedProgress or surface a config error to the user\n  }\n  throw e\n}","preventionTips":["Copy language codes directly from your Localizely project settings.","Use exact langCode format (BCP-47, e.g. 'pt-BR') as reported by the API.","Validate badge URLs against the project's language list at build time."],"tags":["localizely","i18n","invalid-response"],"backgroundTag":"unsupported-language-code","analyzedSha":"766fd8bc89a90b8534dc573ab72dec30215ab1ec","analyzedAt":"2026-08-30T01:40:27.499Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}