Apfel
Introduction
Apfel is simple parser for .strings (DotStrings) files written in Ruby. DotStrings files are used by Apple platforms for localization. Apfel reads DotStrings files, parses them for key-value pairs and comments.
Once in the form of a hash, the content of the DotStrings file can easily be
rebuilt as JSON, XML and RESX (with the help of Builder https://github.com/jimweirich/builder) and more!
Use
To start using Apfel first require the gem
require 'apfel'
Next, pass Apfel the .strings file you want to parse:
parsed_file = Apfel.parse('path/to/file')
Once the file has been parsed, you can do many things with it:
parsed_file.to_hash
parsed_file.to_json
parsed_file.to_hash(with_comments: false)
parsed_file.keys
parsed_file.values
parsed_file.key_values
parsed_file.comments
parsed_file.comments(with_keys: false)
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Commit tests (they should pass when rake is run)
- Push to the branch (
git push origin my-new-feature
) - Create new Pull Request