1
0
Fork 0
mirror of https://github.com/nishiki/manage-password.git synced 2024-11-26 23:33:03 +00:00

translate in french and in english

This commit is contained in:
nishiki 2014-01-10 22:36:51 +01:00
parent 3662bcb251
commit 8530f61b76
4 changed files with 50 additions and 7 deletions

View file

@ -111,6 +111,21 @@ en:
display:
connect: "Connection to:"
nothing: "Nothing result!"
server:
option:
usage: "Usage"
config: "Specifie the configuration file"
checkconfig: "Check the configuration"
setup: "Setup a new configuration file"
help: "Show this message help"
form:
setup:
title: "Serveur configuration"
host: "IP listen: "
port: "Port listen: "
data_dir: "Data directory: "
timeout: "Timeout to second: "
not_valid: "ERROR: Impossible to write the configuration file!"
formats:
default: ! '%Y-%m-%d'
long: ! '%B %d, %Y'

View file

@ -111,6 +111,21 @@ fr:
display:
connect: "Connexion à:"
nothing: "Aucun résultat!"
server:
option:
usage: "Utilisation"
config: "Spécifie le fichier de configuration"
checkconfig: "Vérifie le fichier de configuration"
setup: "Permet de générer un nouveau fichier de configuration"
help: "Affiche ce message d'aide"
form:
setup:
title: "Configuration du serveur"
host: "IP d'écoute: "
port: "Port d'écoute: "
data_dir: "Répertoire des données: "
timeout: "Timeout en seconde: "
not_valid: "ERREUR: Impossible d'écire le fichier de configuration!"
formats:
default: ! '%Y-%m-%d'
long: ! '%B %d, %Y'

View file

@ -260,7 +260,6 @@ class Server
# @args: file_config -> the configuration file
# @rtrn: true if le config file is create
def setup(file_config)
puts I18n.t('server.form.setup.title')
puts '--------------------'
host = ask(I18n.t('server.form.setup.host')).to_s
@ -278,7 +277,7 @@ class Server
file << config.to_yaml
end
rescue Exception => e
@error_msg = "Can't write the config file!\n#{e}"
puts "#{I18n.t('server.formsetup.not_valid')}\n#{e}"
return false
end

View file

@ -6,32 +6,46 @@
require 'rubygems'
require 'optparse'
require 'pathname'
require 'locale'
require 'i18n'
APP_ROOT = File.dirname(Pathname.new(__FILE__).realpath)
require "#{APP_ROOT}/lib/Server.rb"
lang = Locale::Tag.parse(ENV['LANG']).to_simple.to_s[0..1]
I18n::Backend::Simple.send(:include, I18n::Backend::Fallbacks)
I18n.load_path = Dir["#{APP_ROOT}/i18n/*.yml"]
I18n.default_locale = :en
I18n.locale = lang.to_sym
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: mpw-server -c CONFIG [options]"
opts.banner = "#{I18n.t('server.option.usage')}: mpw-server -c CONFIG [options]"
opts.on("-c", "--config CONFIG", "Specifie the configuration file") do |config|
opts.on("-c", "--config CONFIG", I18n.t('server.option.config')) do |config|
options[:config] = config
end
opts.on("-t", "--check-config", "Check your configuration") do |b|
opts.on("-t", "--checkconfig", I18n.t('server.option.checkconfig')) do |b|
options[:checkconfig] = b
end
opts.on("-s", "--setup", "Force a server") do |b|
opts.on("-s", "--setup", I18n.t('server.option.setup')) do |b|
options[:setup] = b
end
opts.on("-h", "--help", "Show this message") do |b|
opts.on("-h", "--help", I18n.t('server.option.help')) do |b|
puts opts
exit 0
end
end.parse!
if options[:config].nil? || options[:config].empty?
puts "#{I18n.t('server.option.usage')}: mpw-server -c CONFIG [options]"
exit 2
end
server = Server.new
if options[:checkconfig]