From 3dcb46502550c96a1e3369214836033c16d8eeb9 Mon Sep 17 00:00:00 2001 From: adrien Date: Thu, 26 Dec 2013 10:57:03 +0100 Subject: [PATCH] add i18n --- mpw-ssh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mpw-ssh b/mpw-ssh index c1b42a6..0e9db73 100755 --- a/mpw-ssh +++ b/mpw-ssh @@ -6,11 +6,21 @@ require 'rubygems' require 'optparse' require 'pathname' +require 'locale' +require 'i18n' APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath) require "#{APP_ROOT}/lib/CliSSH.rb" -cli = CliSSH.new() +lang = Locale::Tag.parse(ENV['LANG']).to_simple.to_s[0..1] + +if !File.exist?("#{APP_ROOT}/i18n/#{lang}.yml") + lang = 'en' +end +I18n.load_path = Dir["#{APP_ROOT}/i18n/#{lang}.yml"] +I18n.locale = lang.to_sym + +cli = CliSSH.new(lang) search = ARGV[0] options = {}