Project

puttext

0.0
No commit activity in last 3 years
No release in over 3 years
Extract gettext strings from Ruby source
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
~> 3.5
~> 0.46.0
~> 3.0

Runtime

< 3.0, >= 2.4.0.0
 Project Readme

Gem Version Build Status Code Climate Test Coverage

puttext

Put translatable gettext strings from your Ruby code to a .po or .pot file.

For example, if you have this translatable.rb file:

puts _('translatable string')

You get this output:

#: translatable.rb:1
msgid "translatable string"
msgstr ""

Language support

Supports extracting strings from these types of files:

  • Ruby
  • Slim

Installation

Using RubyGems:

$ gem install puttext

Or add it to your Gemfile if using Bundler:

gem 'puttext', require: false

Also, if you want additional language support beyond plain Ruby, install these gems:

  • slim for Slim support.

Usage

Just run the puttext command line tool and point it to your Ruby project:

$ puttext /path/to/your/project

Options

-o, --output

By default puttext will output the extracted PO file contents to stdout. You can write the output to a file by specifying the -o, --output option.

$ puttext /path/to/your/project -o template.pot

Contributing

Before submitting an Issue or Pull Request always check if your issue is already being discussed or if someone has already submitted a pull request with the feature you want to add. Also, before doing bigger changes, it's always good to discuss the changes you're going to make in an Issue.

Code style

PutText uses RuboCop (https://github.com/bbatsov/rubocop) to check and enforce code style. Before submitting a pull request, make sure that RuboCop does not find any offenses.

Running RuboCop

$ bundle exec rubocop

Testing

PutText uses RSpec (http://rspec.info/) for testing. Pull requests with Ruby code changes must include RSpec tests that check the new functionality or changed code. Also, make sure that your changes do not break any existing tests.

Running RSpec

$ bundle exec rspec