{"id":26483675,"url":"https://github.com/raymondjavaxx/dotstrings","last_synced_at":"2025-03-20T04:57:37.023Z","repository":{"id":43029865,"uuid":"508940024","full_name":"raymondjavaxx/dotstrings","owner":"raymondjavaxx","description":"A parser for Apple strings files (.strings) written in Ruby.","archived":false,"fork":false,"pushed_at":"2024-05-19T02:41:22.000Z","size":57,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-17T06:18:56.060Z","etag":null,"topics":["dotstrings","ios","localization","ruby"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/dotstrings","language":"Ruby","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/raymondjavaxx.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2022-06-30T05:04:38.000Z","updated_at":"2025-01-19T11:30:16.000Z","dependencies_parsed_at":"2024-02-27T17:46:31.203Z","dependency_job_id":"3f2ac31b-b531-447c-952b-55a70b83920b","html_url":"https://github.com/raymondjavaxx/dotstrings","commit_stats":{"total_commits":76,"total_committers":2,"mean_commits":38.0,"dds":"0.013157894736842146","last_synced_commit":"a758b0b462c2b21f76e3877df24f3b06012302c7"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2Fdotstrings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2Fdotstrings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2Fdotstrings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2Fdotstrings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raymondjavaxx","download_url":"https://codeload.github.com/raymondjavaxx/dotstrings/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244498538,"owners_count":20462345,"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":["dotstrings","ios","localization","ruby"],"created_at":"2025-03-20T04:57:36.583Z","updated_at":"2025-03-20T04:57:37.015Z","avatar_url":"https://github.com/raymondjavaxx.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DotStrings\n\nA parser for Apple *strings* files (`.strings`) written in Ruby. Some of the features of DotStrings include:\n\n* A fast and memory-efficient streaming parser.\n* Support for multiline (`/* ... */`) comments as well as single-line comments (`// ...`).\n* An API for creating strings files programmatically.\n* Handles Unicode and escaped characters.\n* Helpful error messages: know which line and column fail to parse and why.\n* Well [tested](test) and [documented](https://www.rubydoc.info/gems/dotstrings/DotStrings).\n\n## Installing\n\nYou can install DotStrings manually by running:\n\n```shell\n$ gem install dotstrings\n```\n\nOr by adding the following entry to your [Gemfile](https://guides.cocoapods.org/using/a-gemfile.html), then running `$ bundle install`.\n\n```ruby\ngem 'dotstrings'\n```\n\n## Usage\n\nYou can load `.strings` files using the `DotString.parse()` utility method. This method returns a `DotStrings::File` object or raises an exception if the file cannot be parsed.\n\n```ruby\nfile = DotStrings.parse_file('en-US/Localizable.strings')\nfile.items.each do |item|\n  puts item.comment\n  puts item.key\n  puts item.value\nend\n```\n\n## Strict Mode\n\nBy default, the parser runs in *strict mode*. This means that it will raise a `DotStrings::ParsingError` if it encounters comments that are not tied to a key-value pair. For example, the following file will raise an error because the first comment is not followed by a key-value pair:\n\n```\n/* Spanish localizations */\n\n/* Title for a button for accepting something */\n\"Accept\" = \"Aceptar\";\n```\n\nIn *strict mode*, the parser will also raise an error if it encounters escaped characters that don't need to be escaped. For example, the following file will raise an error because the `?` character doesn't need to be escaped:\n\n```\n/* Confirmation message */\n\"Are you sure\\?\" = \"¿Estás seguro\\?\";\n```\n\nIf you want to disable *strict mode*, you can pass `strict: false` to the `DotStrings.parse_file()` method. This will match the behavior of Apple's own parser, which is more lenient.\n\n```ruby\nfile = DotStrings.parse_file('es-ES/Localizable.strings', strict: false)\n```\n\n## Examples\n\n### Accessing items by key\n\n```ruby\nputs file['key 1'].value\n# =\u003e \"value 1\"\n```\n\n### Deleting items by key\n\n```ruby\nfile.delete('key 1')\n```\n\n### Appending items\n\n```ruby\nfile \u003c\u003c DotStrings::Item(\n  comment: 'Title for the cancel button',\n  key: 'button.cancel.title',\n  value: 'Cancel'\n)\n```\n\n### Saving a file\n\n```ruby\nFile.write('en-US/Localizable.strings', file.to_s)\n```\n\nFor more examples, consult the [documentation](https://www.rubydoc.info/gems/dotstrings/DotStrings) or the [test suite](test).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraymondjavaxx%2Fdotstrings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraymondjavaxx%2Fdotstrings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraymondjavaxx%2Fdotstrings/lists"}