{"id":16845730,"url":"https://github.com/othree/po-writer","last_synced_at":"2025-03-18T06:26:35.625Z","repository":{"id":57326574,"uuid":"117659342","full_name":"othree/po-writer","owner":"othree","description":"A simple gettext Po file writer.","archived":false,"fork":false,"pushed_at":"2020-03-31T03:09:28.000Z","size":12,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-24T21:18:12.162Z","etag":null,"topics":["gettext","po"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/po-writer","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/othree.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-01-16T08:59:58.000Z","updated_at":"2022-12-29T21:02:54.000Z","dependencies_parsed_at":"2022-09-21T01:50:24.121Z","dependency_job_id":null,"html_url":"https://github.com/othree/po-writer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othree%2Fpo-writer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othree%2Fpo-writer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othree%2Fpo-writer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/othree%2Fpo-writer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/othree","download_url":"https://codeload.github.com/othree/po-writer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244168221,"owners_count":20409484,"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":["gettext","po"],"created_at":"2024-10-13T12:59:50.291Z","updated_at":"2025-03-18T06:26:35.595Z","avatar_url":"https://github.com/othree.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# po-writer\n\nA simple [gettext](https://www.gnu.org/software/gettext/) Po file writer.\n\n## Usage\n\nCreate instance\n\n```js\nimport Po from 'po-writer';\n\nlet po = new Po();\n```\n\nAdd translations:\n\n```js\npo.add({\n  id: 'hello world',\n  str: '夜露死苦'\n})\n```\n\nCreate write stream and write to file:\n\n```js\nlet stream = fs.createWriteStream(targetFilePath);\n\npo.writeToStream(stream);\n```\n\n## API\n\n### `constructor(headers)`\n\n`headers` is an object contains file header. Current support header fields and default values:\n\n* Project-Id-Version: 'PACKAGE VERSION',\n* POT-Creation-Date: now,\n* PO-Revision-Date: now,\n* Last-Translator: '',\n* Language-Team: 'none',\n* MIME-Version: '1.0',\n* Content-Type: 'text/plain; charset=UTF-8',\n* Content-Transfer-Encoding: '8bit',\n* Plural-Forms: 'nplurals=INTEGER; plural=EXPRESSION;'\n\n### `add(msg|msg[])`\n\nAdd a translated [message](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) to Po.\n`msg` support attributes:\n\n* translatorComments\n* extractedComments\n* reference\n* flag\n* context\n* id\n* plural\n* str (string|string[])\n\n### `remove(id|id[])`\n\nRemove translation message from Po. `id` is a msg id or msg object.\n\n### `writeToStream(stream)`\n\nWrite the content of Po file to writable stream.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fothree%2Fpo-writer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fothree%2Fpo-writer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fothree%2Fpo-writer/lists"}