{"id":28466584,"url":"https://github.com/locize/locize-xcstrings","last_synced_at":"2025-09-13T08:36:50.346Z","repository":{"id":283266050,"uuid":"951197717","full_name":"locize/locize-xcstrings","owner":"locize","description":null,"archived":false,"fork":false,"pushed_at":"2025-04-04T20:42:03.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-08-29T04:53:20.479Z","etag":null,"topics":[],"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,"zenodo":null}},"created_at":"2025-03-19T10:04:14.000Z","updated_at":"2025-04-04T20:42:03.000Z","dependencies_parsed_at":"2025-03-19T11:24:58.130Z","dependency_job_id":"26c8f2b4-2b7c-4794-8747-ac1052e0bb24","html_url":"https://github.com/locize/locize-xcstrings","commit_stats":null,"previous_names":["locize/locize-xcstrings"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/locize/locize-xcstrings","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Flocize-xcstrings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Flocize-xcstrings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Flocize-xcstrings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Flocize-xcstrings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/locize","download_url":"https://codeload.github.com/locize/locize-xcstrings/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/locize%2Flocize-xcstrings/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274939620,"owners_count":25377848,"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","status":"online","status_checked_at":"2025-09-13T02:00:10.085Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2025-06-07T07:04:50.888Z","updated_at":"2025-09-13T08:36:50.327Z","avatar_url":"https://github.com/locize.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/locize/locize-xcstrings/actions/workflows/ci.yml/badge.svg)](https://github.com/locize/locize-xcstrings/actions/workflows/ci.yml) [![npm](https://img.shields.io/npm/v/locize-xcstrings.svg)](https://npmjs.org/package/locize-xcstrings)\n\n## Download\n\nThe source is available for download from\n[GitHub](https://github.com/locize/locize-xcstrings/archive/master.zip).\nAlternatively, you can install using npm:\n\n```sh\nnpm install --save locize-xcstrings\n```\n\nYou can then `import` or `require()` locize-xcstrings as normal:\n\n```js\nimport converter from 'locize-xcstrings'\n// or\nconst converter = require('locize-xcstrings')\n\nconst locizeData = converter.xcstrings2locize(xcstrings)\nconst xcstrings = converter.locize2xcstrings(locizeData)\n```\n\nOr you can direclty `import` or `require()` its functions:\n\n```js\nimport xcstrings2locize from 'locize-xcstrings/xcstrings2locize'\nimport { xcstrings2locize, locize2xcstrings } from 'locize-xcstrings'\n// or\nconst xcstrings2locize = require('locize-xcstrings/cjs/xcstrings2locize')\n```\n\n## Usage\n\n```js\nconst xcstrings = `{\n  \"sourceLanguage\" : \"en\",\n  \"strings\" : {\n    \"empty\" : {\n    },\n    \"empty-str\" : {\n      \"localizations\" : {\n        \"en\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"\"\n          }\n        }\n      }\n    },\n    \"empty-trans\" : {\n      \"localizations\" : {\n        \"en\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"source with value\"\n          }\n        }\n      }\n    },\n    \"empty-trans-str\" : {\n      \"localizations\" : {\n        \"de\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"\"\n          }\n        },\n        \"en\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"source with value\"\n          }\n        }\n      }\n    },\n    \"key1\" : {\n      \"comment\" : \"some comment\",\n      \"localizations\" : {\n        \"de\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"Hallo\"\n          }\n        },\n        \"en\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"Hello\"\n          }\n        }\n      }\n    },\n    \"key2.nested\" : {\n      \"comment\" : \"comment\",\n      \"localizations\" : {\n        \"de\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"xcstrings Daten-Manager\"\n          }\n        },\n        \"en\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"xcstrings Data Manager\"\n          }\n        }\n      }\n    },\n    \"interpolation\" : {\n      \"comment\" : \"some substitution\",\n      \"localizations\" : {\n        \"de\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"%d von %d verbleiben\"\n          }\n        },\n        \"en\" : {\n          \"stringUnit\" : {\n            \"state\" : \"translated\",\n            \"value\" : \"%d of %d remaining\"\n          }\n        }\n      }\n    },\n    \"pluralized\" : {\n      \"comment\" : \"Pluralized translation\",\n      \"localizations\" : {\n        \"de\" : {\n          \"variations\" : {\n            \"plural\" : {\n              \"one\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"%lld Haus\"\n                }\n              },\n              \"other\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"%lld Häuser\"\n                }\n              }\n            }\n          }\n        },\n        \"en\" : {\n          \"variations\" : {\n            \"plural\" : {\n              \"one\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"%lld house\"\n                }\n              },\n              \"other\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"%lld houses\"\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"vars\" : {\n      \"localizations\" : {\n        \"de\" : {\n          \"variations\" : {\n            \"device\" : {\n              \"iphone\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"eine Übersetzung für das iPhone\"\n                }\n              },\n              \"other\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"eine andere Übersetzung\"\n                }\n              }\n            }\n          }\n        },\n        \"en\" : {\n          \"variations\" : {\n            \"device\" : {\n              \"iphone\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"a translation for the iPhone\"\n                }\n              },\n              \"other\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"an other translation\"\n                }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"vars-pluralized-dev\" : {\n      \"comment\" : \"ctx1\",\n      \"localizations\" : {\n        \"de\" : {\n          \"variations\" : {\n            \"device\" : {\n              \"appletv\" : {\n                \"variations\" : {\n                  \"plural\" : {\n                    \"one\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"ein Apple TV\"\n                      }\n                    },\n                    \"other\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"%lld Apple TVs\"\n                      }\n                    }\n                  }\n                }\n              },\n              \"iphone\" : {\n                \"variations\" : {\n                  \"plural\" : {\n                    \"one\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"ein Iphone\"\n                      }\n                    },\n                    \"other\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"%lld Iphones\"\n                      }\n                    }\n                  }\n                }\n              },\n              \"other\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"%lld Geräte\"\n                }\n              }\n            }\n          }\n        },\n        \"en\" : {\n          \"variations\" : {\n            \"device\" : {\n              \"appletv\" : {\n                \"variations\" : {\n                  \"plural\" : {\n                    \"one\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"one apple tv\"\n                      }\n                    },\n                    \"other\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"%lld apple tvs\"\n                      }\n                    }\n                  }\n                }\n              },\n              \"iphone\" : {\n                \"variations\" : {\n                  \"plural\" : {\n                    \"one\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"an iphone\"\n                      }\n                    },\n                    \"other\" : {\n                      \"stringUnit\" : {\n                        \"state\" : \"translated\",\n                        \"value\" : \"%lld iphones\"\n                      }\n                    }\n                  }\n                }\n              },\n              \"other\" : {\n                \"stringUnit\" : {\n                  \"state\" : \"translated\",\n                  \"value\" : \"%lld devices\"\n                }\n              }\n            }\n          }\n        }\n      }\n    }\n  },\n  \"version\" : \"1.0\"\n}\n\nconst locizeData = {\n  \"sourceLng\": \"en\",\n  \"resources\": {\n    \"en\": {\n      \"empty\" : {},\n      \"empty-str\" : {\n        \"value\": \"\"\n      },\n      \"empty-trans\" : {\n        \"value\" : \"source with value\"\n      },\n      \"empty-trans-str\" : {\n        \"value\" : \"source with value\"\n      },\n      \"key1\": {\n        \"value\": \"Hello\",\n        \"context\": {\n          \"text\": \"some comment\"\n        }\n      },\n      \"key2.nested\": {\n        \"value\": \"xcstrings Data Manager\",\n        \"context\": {\n          \"text\": \"comment\"\n        }\n      },\n      \"interpolation\": {\n        \"value\": \"%d of %d remaining\",\n        \"context\": {\n          \"text\": \"some substitution\"\n        }\n      },\n      \"pluralized[variations.plural.one]\": {\n        \"value\": \"%lld house\",\n        \"context\": {\n          \"text\": \"Pluralized translation\"\n        }\n      },\n      \"pluralized[variations.plural.other]\": {\n        \"value\": \"%lld houses\"\n      },\n      \"vars[variations.device.iphone]\": {\n        \"value\": \"a translation for the iPhone\"\n      },\n      \"vars[variations.device.other]\": {\n        \"value\": \"an other translation\"\n      },\n      \"vars-pluralized-dev[variations.device.appletv[variations.plural.one]]\": {\n        \"value\": \"one apple tv\",\n        \"context\": {\n          \"text\": \"ctx1\"\n        }\n      },\n      \"vars-pluralized-dev[variations.device.appletv[variations.plural.other]]\": {\n        \"value\": \"%lld apple tvs\"\n      },\n      \"vars-pluralized-dev[variations.device.iphone[variations.plural.one]]\": {\n        \"value\": \"an iphone\"\n      },\n      \"vars-pluralized-dev[variations.device.iphone[variations.plural.other]]\": {\n        \"value\": \"%lld iphones\"\n      },\n      \"vars-pluralized-dev[variations.device.other]\": {\n        \"value\": \"%lld devices\"\n      }\n    },\n    \"de\": {\n      \"empty-trans-str\" : {\n        \"value\" : \"\"\n      },\n      \"key1\": {\n        \"value\": \"Hallo\"\n      },\n      \"key2.nested\": {\n        \"value\": \"xcstrings Daten-Manager\"\n      },\n      \"interpolation\": {\n        \"value\": \"%d von %d verbleiben\"\n      },\n      \"pluralized[variations.plural.one]\": {\n        \"value\": \"%lld Haus\"\n      },\n      \"pluralized[variations.plural.other]\": {\n        \"value\": \"%lld Häuser\"\n      },\n      \"vars[variations.device.iphone]\": {\n        \"value\": \"eine Übersetzung für das iPhone\"\n      },\n      \"vars[variations.device.other]\": {\n        \"value\": \"eine andere Übersetzung\"\n      },\n      \"vars-pluralized-dev[variations.device.appletv[variations.plural.one]]\": {\n        \"value\": \"ein Apple TV\"\n      },\n      \"vars-pluralized-dev[variations.device.appletv[variations.plural.other]]\": {\n        \"value\": \"%lld Apple TVs\"\n      },\n      \"vars-pluralized-dev[variations.device.iphone[variations.plural.one]]\": {\n        \"value\": \"ein Iphone\"\n      },\n      \"vars-pluralized-dev[variations.device.iphone[variations.plural.other]]\": {\n        \"value\": \"%lld Iphones\"\n      },\n      \"vars-pluralized-dev[variations.device.other]\": {\n        \"value\": \"%lld Geräte\"\n      }\n    }\n  },\n  \"version\": \"1.0\"\n}`\n\nimport { xcstrings2locize, locize2xcstrings } from 'locize-xcstrings'\n\nconst res = xcstrings2locize(xcstrings)\n// res is like locizeData\n\nconst res = locize2xcstrings(locizeData)\n// res is like xcstrings\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocize%2Flocize-xcstrings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocize%2Flocize-xcstrings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocize%2Flocize-xcstrings/lists"}