
Security News
Oxlint Introduces Type-Aware Linting Preview
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Version: 0.1.17
Use Google Translate without an API key.
Like me, maybe you've found that Google makes it a pain to work with their API. Tr4n5l4te gets around all that.
First, install PhantomJS.
Add this line to your application's Gemfile:
gem 'tr4n5l4te'
And then execute:
$ bundle
Or install it yourself as:
$ gem install tr4n5l4te
In your code:
translator = Tr4n5l4te::Translator.new
english_strings = [
'hello',
'how are you'
]
english_strings.each do |text|
puts translator.translate(text, :en, :es)
end
# => hola
# => cómo estás
➤ ./exe/translate -h
Options:
-y, --yaml-file=<s> A YAML locale file - filename determines source language 'en.yml' - English
-l, --lang=<s> Destination language
-i, --list List known languages
-s, --sleep-time=<i> Sleep time (default: 2)
-t, --timeout=<i> Poltergeist timeout option (default: 30)
-v, --verbose Be verbose with output
-h, --help Show this message
To translate a YAML file:
$ ./exe/translate -y /path/to/yml/file -l "destination-language"
The translator will sleep for 2 seconds, by default, between each string translation. You can override that by passing in the amount of time, in seconds, you want it to sleep:
$ ./exe/translate -y config/locales/en.yml -l French -s 3
Warning: If you pass in '0' and translate a large file, it is very likely that Google will ban your IP address.
To list all known languages
$ ./exe/translate --list
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
The specs are sprinkled with integration tests which will actually go out and hit the live web. To run them:
$ INTEGRATION=1 rake spec
Please be kind or Google is likely to ban your IP address.
$ INTEGRATION=1 COVERAGE=1 rake spec
$ open coverage/index.html # if you are on OSX
Bug reports and pull requests are welcome on GitHub at https://github.com/midwire/tr4n5l4te.
Thanks to all of those who contribute!
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that tr4n5l4te demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oxlint’s new preview brings type-aware linting powered by typescript-go, combining advanced TypeScript rules with native-speed performance.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.