#!/usr/bin/ruby # MPW is a software to crypt and manage your passwords # Copyright (C) 2016 Adrien Waksberg <mpw@yae.im> # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License # as published by the Free Software Foundation; either version 2 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. $: << File.expand_path('../../lib', __FILE__) require 'locale' require 'set' require 'i18n' # --------------------------------------------------------- # # Set local # --------------------------------------------------------- # lang = Locale::Tag.parse(ENV['LANG']).to_simple.to_s[0..1] if defined?(I18n.enforce_available_locales) I18n.enforce_available_locales = true end I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks) I18n.load_path = Dir["#{File.expand_path('../../i18n', __FILE__)}/*.yml"] I18n.default_locale = :en I18n.locale = lang.to_sym # --------------------------------------------------------- # # Options # --------------------------------------------------------- # bin_dir = File.dirname(__FILE__) command = "#{bin_dir}/mpw-#{ARGV[0]}" if Dir.glob("#{bin_dir}/mpw-*").include?("#{command}") Kernel.load(command) end