Rails Translation Manager (RTM) provides validation for locale files, and exposes several rake tasks which can be used to manage your translations. It can only be used on Rails apps.
Technical documentation
Installation
Add this line to your application’s Gemfile:
gem 'rails_translation_manager'
After a bundle install, this will make a number of rake tasks available to your application.
See the Rake command reference below.
You will now also be able to run tests against your locale files to ensure that they are valid.
Create a test file as follows.
Minitest
class LocalesValidationTest < ActiveSupport::TestCase
test "should validate all locale files" do
checker = RailsTranslationManager::LocaleChecker.new("config/locales/*.yml")
assert checker.validate_locales
end
end
RSpec
RSpec.describe "locales files" do
it "should meet all locale validation requirements" do
checker = RailsTranslationManager::LocaleChecker.new("config/locales/*/*.yml")
expect(checker.validate_locales).to be_truthy
end
end
Running the test suite
To run the test suite just run bundle exec rake from within the
rails_translation_manager directory.