{"id":18085,"library":"acc-lang-parser","title":"acc-lang-parser","description":"A simple parser for HTTP Accept-Language headers in Node.js. Version 1.0.4 (last released in 2016) extracts the first language or all language ranges from a header string. Returns objects with 'language' and 'locale' fields. Unlike more modern alternatives like 'accept-language-parser', this package has limited features, no TypeScript support, and is unmaintained. It was originally published under the npm name 'parse-acc-lang' (now deprecated) and later republished as 'acc-lang-parser'.","status":"maintenance","version":"1.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/adcloud/acc-lang-parser","tags":["javascript","http","accept-language","parser","nodejs"],"install":[{"cmd":"npm install acc-lang-parser","lang":"bash","label":"npm"},{"cmd":"yarn add acc-lang-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add acc-lang-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CommonJS-only, does not support ESM imports. The npm package name is 'acc-lang-parser' but the require path string is 'parse-acc-lang' (the old name).","wrong":"import parser from 'parse-acc-lang';","symbol":"parse-acc-lang","correct":"const parser = require('parse-acc-lang');"},{"note":"Returns a single object with language and locale, or null if invalid input.","symbol":"extractFirstLang","correct":"const result = parser.extractFirstLang('de-DE');"},{"note":"Returns an array of objects. No options parameter is supported.","wrong":"const results = parser.extractAllLangs('de-DE, en-GB', { strict: true });","symbol":"extractAllLangs","correct":"const results = parser.extractAllLangs('de-DE, en-GB');"}],"quickstart":{"code":"const parser = require('parse-acc-lang');\nconst header = 'de-DE, en-GB;q=0.9, fr;q=0.8';\nconst first = parser.extractFirstLang(header);\nconsole.log(first); // { language: 'de', locale: 'DE' }\nconst all = parser.extractAllLangs(header);\nconsole.log(all);\n// [\n//   { language: 'de', locale: 'DE' },\n//   { language: 'en', locale: 'GB' },\n//   { language: 'fr', locale: '' }\n// ]","lang":"javascript","description":"Parses an Accept-Language header to get the first language and all languages."},"warnings":[{"fix":"Use require('parse-acc-lang') in code, not require('acc-lang-parser').","message":"Package name mismatch: npm package is 'acc-lang-parser' but require path uses 'parse-acc-lang'.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"Create your own .d.ts file or use a modern alternative with TypeScript support.","message":"No TypeScript definitions available.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Check for empty locale string before use.","message":"If extracted language tag has no locale (e.g., 'fr'), the locale field is an empty string ''.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use a more complete parser like 'accept-language-parser' if you need quality weighting.","message":"Quality values (q=) are ignored; the parser does not sort by weight.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1.0.4':17 '2016':21 'acc':2,71,80 'acc-lang-pars':1,79 'accept':11,47,86 'accept-languag':10,85 'accept-language-pars':46 'altern':44 'deprec':74 'extract':22 'featur':54 'field':40 'first':24 'header':13,32 'http':9,84 'javascript':83 'lang':3,72,81 'languag':12,25,28,37,48,87 'last':18 'later':76 'like':45 'limit':53 'local':39 'modern':43 'name':68 'node.js':15 'nodej':89 'npm':67 'object':35 'origin':63 'packag':51 'pars':70 'parse-acc-lang':69 'parser':4,7,49,82,88 'publish':64 'rang':29 'releas':19 'republish':77 'return':34 'simpl':6 'string':33 'support':57 'typescript':56 'unlik':41 'unmaintain':60 'version':16","created_at":"2026-04-25T07:36:25.041548+00:00","updated_at":"2026-04-25T07:36:25.041548+00:00","problems":[{"fix":"Use require('parse-acc-lang') in your code, even though the npm package name is 'acc-lang-parser'.","cause":"Using require('acc-lang-parser') instead of require('parse-acc-lang').","error":"Error: Cannot find module 'parse-acc-lang'"},{"fix":"Ensure you require('parse-acc-lang') and that the module exports the correct functions.","cause":"Incorrect import path or using a different package version.","error":"TypeError: parser.extractFirstLang is not a function"},{"fix":"Pass a valid Accept-Language header string. For null/undefined, manually handle or return a default.","cause":"Input header is null, undefined, or an empty string.","error":"Expected an object but got undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/adcloud/acc-lang-parser","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/acc-lang-parser","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}