{"id":28466615,"url":"https://github.com/locize/gettext-converter","last_synced_at":"2025-07-05T01:36:33.885Z","repository":{"id":44532356,"uuid":"256480799","full_name":"locize/gettext-converter","owner":"locize","description":"po2js and js2po and i18next2po and po2i18next converter gettext resource utils","archived":false,"fork":false,"pushed_at":"2024-03-12T10:05:48.000Z","size":1591,"stargazers_count":6,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-06-30T08:15:13.359Z","etag":null,"topics":["converter","format","gettext","i18next","javascript","js","json","po"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/locize.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-17T11:10:30.000Z","updated_at":"2024-12-20T23:50:16.000Z","dependencies_parsed_at":"2024-03-12T11:32:04.213Z","dependency_job_id":"b08a2cb6-a66e-41ec-89b4-13927da38d32","html_url":"https://github.com/locize/gettext-converter","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/locize/gettext-converter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Fgettext-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Fgettext-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Fgettext-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Fgettext-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locize","download_url":"https://codeload.github.com/locize/gettext-converter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Fgettext-converter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262868209,"owners_count":23377211,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["converter","format","gettext","i18next","javascript","js","json","po"],"created_at":"2025-06-07T07:04:52.041Z","updated_at":"2025-06-30T23:32:59.267Z","avatar_url":"https://github.com/locize.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![travis](https://img.shields.io/travis/locize/gettext-converter.svg)](https://travis-ci.org/locize/gettext-converter) [![npm](https://img.shields.io/npm/v/gettext-converter.svg)](https://npmjs.org/package/gettext-converter)\n\n## Download\n\nThe source is available for download from\n[GitHub](https://github.com/locize/gettext-converter/archive/master.zip).\nAlternatively, you can install using npm:\n\n```sh\nnpm install --save gettext-converter\n```\n\nYou can then `import` or `require()` gettext-converter as normal:\n\n```js\nimport gettext from 'gettext-converter'\n// or\nconst gettext = require('gettext-converter')\n\nconst js = gettext.po2js(po)\n```\n\nOr you can direclty `import` or `require()` its functions:\n\n```js\nimport po2js from 'gettext-converter/po2js'\n// or\nconst po2js = require('gettext-converter/cjs/po2js')\n```\n\n## Usage\n\n```js\n\nconst po = `msgid \"\"\nmsgstr \"\"\n\"Project-Id-Version: gettext-converter\\n\"\n\"mime-version: 1.0\\n\"\n\"Content-Type: text/plain; charset=utf-8\\n\"\n\"Content-Transfer-Encoding: 8bit\\n\"\n\"Plural-Forms: nplurals=2; plural=(n != 1)\\n\"\n\"POT-Creation-Date: 2020-04-17T10:46:16.313Z\\n\"\n\"PO-Revision-Date: 2020-04-17T10:46:16.313Z\\n\"\n\nmsgid \"my-key\"\nmsgstr \"myvalue\"`\n\nconst js = {\n  charset: 'utf-8',\n  headers: {\n    'Project-Id-Version': 'gettext-converter',\n    'mime-version': '1.0',\n    'Content-Type': 'text/plain; charset=utf-8',\n    'Content-Transfer-Encoding': '8bit',\n    'Plural-Forms': 'nplurals=2; plural=(n != 1)',\n    'POT-Creation-Date': '2020-04-17T10:46:16.313Z',\n    'PO-Revision-Date': '2020-04-17T10:46:16.313Z'\n  },\n  translations: {\n  '': {\n    '': {\n      msgid: '',\n      msgstr: [\n        'Project-Id-Version: gettext-converter\\n' +\n          'mime-version: 1.0\\n' +\n          'Content-Type: text/plain; charset=utf-8\\n' +\n          'Content-Transfer-Encoding: 8bit\\n' +\n          'Plural-Forms: nplurals=2; plural=(n != 1)\\n' +\n          'POT-Creation-Date: 2020-04-17T10:46:16.313Z\\n' +\n          'PO-Revision-Date: 2020-04-17T10:46:16.313Z\\n'\n      ]\n    },\n    'my-key': { msgid: 'my-key', msgstr: [ 'myvalue' ] }\n  }\n}\n\n\nimport po2js from 'gettext-converter/po2js'\nconst res = po2js(po)\n// res is like js\n\nimport js2po from 'gettext-converter/js2po'\nconst res = js2po(js)\n// res is like po\n\n\nconst i18nextJs = { 'my-key': 'myvalue' }\n\nimport po2i18next from 'gettext-converter/po2i18next'\nconst res = po2i18next(po)\n// res is like i18nextJs\n\nimport i18next2po from 'gettext-converter/i18next2po'\nconst res = i18next2po('en', i18nextJs)\n// res is like po\n```\n\n### i18next json format v4 support\n\n```javascript\nconst i18nextJs = {\n  'key_one': 'a value',\n  'key_other': 'some values'\n}\n\nimport i18next2po from 'gettext-converter/i18next2po'\nconst res = i18next2po('en', i18nextJs, { compatibilityJSON: 'v4' })\n\nimport po2i18next from 'gettext-converter/po2i18next'\nconst res = po2i18next(po, { compatibilityJSON: 'v4' })\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocize%2Fgettext-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocize%2Fgettext-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocize%2Fgettext-converter/lists"}