Sha256: 61c0bd9eefb8840d32f22261e2977c453ffc1f16d178b89c51d735aa41217e5c
Contents?: true
Size: 1.92 KB
Versions: 1
Compression:
Stored size: 1.92 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true require "optparse" require "habluhablu" require "translation" args = {} OptionParser.new do |opts| opts.banner = "Generate files including basic phrases translations (using with I18n gem)" opts.on("-l", "--language SYMBOL", "Symbol of the language you want to generate file for (en, es, ...).") opts.on("-m", "--multi SYMBOLS", "Symbols of languages you want to generate files for (en es pl ar)") opts.on("-k", "--keyword KEYWORD", "Add your own keyword for all language files (.yml).") opts.on("-s", "--sample FILES", "Add your own sample for language files (.yml).") opts.on("-t", "--translate TEXT", "Translation text example: Hello_world_test!") opts.on("-f", "--from SYMBOL", "From example: en") opts.on("-o", "--target SYMBOL", "Target language example: es") end.parse!(into: args) information = lambda do |param| if File.exist?("config/locales/#{param}.yml") puts "..." sleep 0.5 puts "Everything was generated successfully!" else puts "Something went wrong!" end end if args[:translate].nil? == false if args[:from].nil? == false translator = Translation.new(args[:translate], args[:target]) else translator = Translation.new(args[:translate], args[:target], args[:from]) end end translator.response information.call(args[:target]) if args[:language].nil? == false Habluhablu.hablu(args[:language]) information.call(args[:language]) end if args[:keyword].nil? == false Habluhablu.keyword(args[:keyword]) puts "..." sleep 0.5 puts "Everything was added successfully!" end if args[:multi].nil? == false languages_array = args[:multi].split("_") languages_array.each do |language| Habluhablu.hablu(language) end information.call(languages_array.last) end if args[:sample].nil? == false Habluhablu.render_sample(args[:sample]) information.call("sample") end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
habluhablu-0.4.2 | exe/habluhablu |