From 3f5fdf77773055d71c4a5c5244276cbabc7711b6 Mon Sep 17 00:00:00 2001 From: Paolo Capriotti Date: Sun, 14 Feb 2010 10:42:52 +0000 Subject: [PATCH] i18n improvements. Make plugins translatable by loading them after creating the appliation. Make more string translatable. --- kaya.pot | 76 +++++++++++++++++++++++++++----- lib/games/games.rb | 4 +- lib/kaya.rb | 7 ++- lib/plugins/chess/chess.rb | 12 ++--- lib/plugins/clocks/lib/clock_display.rb | 2 +- lib/plugins/crazyhouse/crazyhouse.rb | 2 +- lib/plugins/ics/lib/preferences.rb | 6 +-- lib/plugins/movelist/simple_movelist.rb | 2 +- lib/plugins/shogi/shogi.rb | 4 +- translations/it.po | 78 ++++++++++++++++++++++++++++----- 10 files changed, 154 insertions(+), 39 deletions(-) diff --git a/kaya.pot b/kaya.pot index 8888d50..e08601e 100644 --- a/kaya.pot +++ b/kaya.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: http://github.com/pcapriotti/kaya/issues\n" -"POT-Creation-Date: 2010-02-13 23:23+0000\n" +"POT-Creation-Date: 2010-02-14 10:32+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -67,39 +67,39 @@ msgstr "" msgid "Edit Engine" msgstr "" -#: lib/kaya.rb:25 +#: lib/kaya.rb:23 msgid "Kaya" msgstr "" -#: lib/kaya.rb:26 +#: lib/kaya.rb:24 msgid "KDE Board Game Suite" msgstr "" -#: lib/kaya.rb:27 +#: lib/kaya.rb:25 msgid "(C) 2009 Paolo Capriotti" msgstr "" -#: lib/kaya.rb:28 +#: lib/kaya.rb:26 msgid "Paolo Capriotti" msgstr "" -#: lib/kaya.rb:29 +#: lib/kaya.rb:27 msgid "Jani Huhtanen" msgstr "" -#: lib/kaya.rb:29 +#: lib/kaya.rb:27 msgid "Gaussian blur code" msgstr "" -#: lib/kaya.rb:30 +#: lib/kaya.rb:28 msgid "Yann Dirson" msgstr "" -#: lib/kaya.rb:30 +#: lib/kaya.rb:28 msgid "Minishogi" msgstr "" -#: lib/kaya.rb:32 +#: lib/kaya.rb:30 msgid "Initial game" msgstr "" @@ -151,6 +151,38 @@ msgstr "" msgid "Human" msgstr "" +#: lib/plugins/chess/chess.rb:28 +msgid "Chess" +msgstr "" + +#: lib/plugins/chess/chess.rb:60 +msgid "Promote to &Queen" +msgstr "" + +#: lib/plugins/chess/chess.rb:64 +msgid "Promote to &Rook" +msgstr "" + +#: lib/plugins/chess/chess.rb:68 +msgid "Promote to &Bishop" +msgstr "" + +#: lib/plugins/chess/chess.rb:72 +msgid "Promote to &Knight" +msgstr "" + +#: lib/plugins/chess/chess.rb:99 +msgid "Chess 5x5" +msgstr "" + +#: lib/plugins/clocks/lib/clock_display.rb:48 +msgid "(unknown)" +msgstr "" + +#: lib/plugins/crazyhouse/crazyhouse.rb:19 +msgid "Crazyhouse" +msgstr "" + #: lib/plugins/ics/ics.rb:28 msgid "&Connect to ICS" msgstr "" @@ -163,6 +195,30 @@ msgstr "" msgid "Configure &ICS..." msgstr "" +#: lib/plugins/ics/lib/preferences.rb:21 +msgid "&Username:" +msgstr "" + +#: lib/plugins/ics/lib/preferences.rb:29 +msgid "&Password:" +msgstr "" + +#: lib/plugins/ics/lib/preferences.rb:38 +msgid "Configure ICS" +msgstr "" + +#: lib/plugins/movelist/simple_movelist.rb:63 +msgid "Mainline" +msgstr "" + +#: lib/plugins/shogi/shogi.rb:28 +msgid "Shogi" +msgstr "" + +#: lib/plugins/shogi/shogi.rb:79 +msgid "MiniShogi" +msgstr "" + #: lib/theme_prefs.rb:24 msgid "&Games" msgstr "" diff --git a/lib/games/games.rb b/lib/games/games.rb index bd4da6c..f725b23 100644 --- a/lib/games/games.rb +++ b/lib/games/games.rb @@ -39,7 +39,7 @@ class Game KDE::ComboBox.new(parent) do self.editable = false GAMES.map do |id, g| - [g.class.data(:name), id.to_s] + [g.class.plugin_name, id.to_s] end.sort.each do |name, id| add_item(name, Qt::Variant.new(id)) end @@ -48,7 +48,7 @@ class Game def self.new_list(parent) games = GAMES.map do |id, g| - [g.class.data(:name), g] + [g.class.plugin_name, g] end.sort Qt::ListWidget.from_a(parent, games) end diff --git a/lib/kaya.rb b/lib/kaya.rb index ec2b8dd..704df34 100644 --- a/lib/kaya.rb +++ b/lib/kaya.rb @@ -9,8 +9,6 @@ $:.unshift(File.dirname(__FILE__)) require 'qtutils' require 'mainwindow' -require 'plugins/loader' -require 'games/all' def version "0.3" @@ -31,6 +29,8 @@ def start_kaya :bug_tracker => 'http://github.com/pcapriotti/kaya/issues', :options => [['+[game]', KDE.ki18n('Initial game')]]) + require 'plugins/loader' + require 'games/all' require 'ext/loader' args = KDE::CmdLineArgs.parsed_args @@ -47,8 +47,11 @@ def start_kaya game ||= Game.get(default_game) plugin_loader = PluginLoader.new + main = MainWindow.new(plugin_loader, game) + + main.show app.exec end diff --git a/lib/plugins/chess/chess.rb b/lib/plugins/chess/chess.rb index ee70054..32e23ed 100644 --- a/lib/plugins/chess/chess.rb +++ b/lib/plugins/chess/chess.rb @@ -25,7 +25,7 @@ class Game include Plugin include GameActions - plugin :name => 'Chess', + plugin :name => KDE::i18n('Chess'), :id => :chess, :interface => :game, :category => 'Chess', @@ -57,19 +57,19 @@ class Game @game_extensions = %w(pgn) action :promote_to_queen, - :text => 'Promote to &Queen' do |policy| + :text => KDE::i18n('Promote to &Queen') do |policy| policy.promotion = :queen end action :promote_to_rook, - :text => 'Promote to &Rook' do |policy| + :text => KDE::i18n('Promote to &Rook') do |policy| policy.promotion = :rook end action :promote_to_bishop, - :text => 'Promote to &Bishop' do |policy| + :text => KDE::i18n('Promote to &Bishop') do |policy| policy.promotion = :bishop end action :promote_to_knight, - :text => 'Promote to &Knight' do |policy| + :text => KDE::i18n('Promote to &Knight') do |policy| policy.promotion = :knight end end @@ -96,7 +96,7 @@ end module Chess5x5 class Game < Chess::Game - plugin :name => 'Chess 5x5', + plugin :name => KDE::i18n('Chess 5x5'), :id => :chess5x5, :interface => :game, :category => 'Chess' diff --git a/lib/plugins/clocks/lib/clock_display.rb b/lib/plugins/clocks/lib/clock_display.rb index afb6233..0c0143e 100644 --- a/lib/plugins/clocks/lib/clock_display.rb +++ b/lib/plugins/clocks/lib/clock_display.rb @@ -45,7 +45,7 @@ module ClockDisplay def data=(d) @caption = d[:color].to_s.capitalize - @player = d[:player] || '(unknown)' + @player = d[:player] || i18n('(unknown)') items[:caption].text = @caption items[:player].text = @player diff --git a/lib/plugins/crazyhouse/crazyhouse.rb b/lib/plugins/crazyhouse/crazyhouse.rb index 4c28a03..ec4df81 100644 --- a/lib/plugins/crazyhouse/crazyhouse.rb +++ b/lib/plugins/crazyhouse/crazyhouse.rb @@ -16,7 +16,7 @@ module Crazyhouse class Game include Plugin - plugin :name => 'Crazyhouse', + plugin :name => KDE::i18n('Crazyhouse'), :interface => :game, :id => :crazyhouse, :category => 'Chess', diff --git a/lib/plugins/ics/lib/preferences.rb b/lib/plugins/ics/lib/preferences.rb index c7a749b..887b2f9 100644 --- a/lib/plugins/ics/lib/preferences.rb +++ b/lib/plugins/ics/lib/preferences.rb @@ -18,7 +18,7 @@ class Preferences < KDE::Dialog layout = Qt::VBoxLayout.new(widget) tmp = Qt::HBoxLayout.new - label = Qt::Label.new("&Username:", widget) + label = Qt::Label.new(KDE::i18n("&Username:"), widget) tmp.add_widget(label) username = Qt::LineEdit.new(widget) tmp.add_widget(username) @@ -26,7 +26,7 @@ class Preferences < KDE::Dialog layout.add_layout(tmp) tmp = Qt::HBoxLayout.new - label = Qt::Label.new("&Password:", widget) + label = Qt::Label.new(KDE::i18n("&Password:"), widget) tmp.add_widget(label) password = Qt::LineEdit.new(widget) password.echo_mode = Qt::LineEdit::Password @@ -35,7 +35,7 @@ class Preferences < KDE::Dialog layout.add_layout(tmp) self.main_widget = widget - self.caption = "Configure ICS" + self.caption = KDE::i18n("Configure ICS") data = Config.load username.text = data[:username] diff --git a/lib/plugins/movelist/simple_movelist.rb b/lib/plugins/movelist/simple_movelist.rb index e4b63b2..acf7459 100644 --- a/lib/plugins/movelist/simple_movelist.rb +++ b/lib/plugins/movelist/simple_movelist.rb @@ -60,7 +60,7 @@ class SimpleMoveList < Qt::ListView def move(i) if i == 0 - 'Mainline' + i18n('Mainline') else state = @history[i - 1].state move = @history[i].move diff --git a/lib/plugins/shogi/shogi.rb b/lib/plugins/shogi/shogi.rb index bfd687d..dabad39 100644 --- a/lib/plugins/shogi/shogi.rb +++ b/lib/plugins/shogi/shogi.rb @@ -25,7 +25,7 @@ class Game include Plugin include GameActions - plugin :name => 'Shogi', + plugin :name => KDE::i18n('Shogi'), :id => :shogi, :interface => :game, :category => 'Shogi', @@ -76,7 +76,7 @@ end module MiniShogi class Game < Shogi::Game - plugin :name => 'MiniShogi', + plugin :name => KDE::i18n('MiniShogi'), :id => :minishogi, :interface => :game, :category => 'Shogi' diff --git a/translations/it.po b/translations/it.po index 8f1c8ef..74fbca8 100644 --- a/translations/it.po +++ b/translations/it.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: 0.3\n" "Report-Msgid-Bugs-To: http://github.com/pcapriotti/kaya/issues\n" -"POT-Creation-Date: 2010-02-13 23:23+0000\n" +"POT-Creation-Date: 2010-02-14 10:32+0000\n" "PO-Revision-Date: 2010-02-13 23:10+0000\n" "Last-Translator: Paolo Capriotti \n" "Language-Team: Italian\n" @@ -66,39 +66,39 @@ msgstr "Nuova engine" msgid "Edit Engine" msgstr "Modifica engine" -#: lib/kaya.rb:25 +#: lib/kaya.rb:23 msgid "Kaya" msgstr "Kaya" -#: lib/kaya.rb:26 +#: lib/kaya.rb:24 msgid "KDE Board Game Suite" msgstr "Collezione di giochi da tavolo per KDE" -#: lib/kaya.rb:27 +#: lib/kaya.rb:25 msgid "(C) 2009 Paolo Capriotti" msgstr "(C) 2009 Paolo Capriotti" -#: lib/kaya.rb:28 +#: lib/kaya.rb:26 msgid "Paolo Capriotti" msgstr "Paolo Capriotti" -#: lib/kaya.rb:29 +#: lib/kaya.rb:27 msgid "Jani Huhtanen" msgstr "Jani Huhtanen" -#: lib/kaya.rb:29 +#: lib/kaya.rb:27 msgid "Gaussian blur code" msgstr "Codice per il blur gaussiano" -#: lib/kaya.rb:30 +#: lib/kaya.rb:28 msgid "Yann Dirson" msgstr "Yann Dirson" -#: lib/kaya.rb:30 +#: lib/kaya.rb:28 msgid "Minishogi" msgstr "Minishogi" -#: lib/kaya.rb:32 +#: lib/kaya.rb:30 msgid "Initial game" msgstr "Gioco iniziale" @@ -124,7 +124,7 @@ msgstr "Configura &temi..." #: lib/mainwindow.rb:129 msgid "History" -msgstr "Storia" +msgstr "Cronologia" #: lib/mainwindow.rb:146 msgid "Console" @@ -150,6 +150,38 @@ msgstr "Apri in una nuova &scheda" msgid "Human" msgstr "Umano" +#: lib/plugins/chess/chess.rb:28 +msgid "Chess" +msgstr "Scacchi" + +#: lib/plugins/chess/chess.rb:60 +msgid "Promote to &Queen" +msgstr "Promuovi a &Donna" + +#: lib/plugins/chess/chess.rb:64 +msgid "Promote to &Rook" +msgstr "Promuovi a &Torre" + +#: lib/plugins/chess/chess.rb:68 +msgid "Promote to &Bishop" +msgstr "Promuovi ad &Alfiere" + +#: lib/plugins/chess/chess.rb:72 +msgid "Promote to &Knight" +msgstr "Promuovi a &Cavallo" + +#: lib/plugins/chess/chess.rb:99 +msgid "Chess 5x5" +msgstr "Scacchi 5x5" + +#: lib/plugins/clocks/lib/clock_display.rb:48 +msgid "(unknown)" +msgstr "(sconosciuto)" + +#: lib/plugins/crazyhouse/crazyhouse.rb:19 +msgid "Crazyhouse" +msgstr "Crazyhouse" + #: lib/plugins/ics/ics.rb:28 msgid "&Connect to ICS" msgstr "&Connetti a ICS" @@ -162,6 +194,30 @@ msgstr "&Disconnetti da ICS" msgid "Configure &ICS..." msgstr "Configura &ICS..." +#: lib/plugins/ics/lib/preferences.rb:21 +msgid "&Username:" +msgstr "&Nome utente:" + +#: lib/plugins/ics/lib/preferences.rb:29 +msgid "&Password:" +msgstr "&Password" + +#: lib/plugins/ics/lib/preferences.rb:38 +msgid "Configure ICS" +msgstr "Configura ICS" + +#: lib/plugins/movelist/simple_movelist.rb:63 +msgid "Mainline" +msgstr "Linea principale" + +#: lib/plugins/shogi/shogi.rb:28 +msgid "Shogi" +msgstr "Shogi" + +#: lib/plugins/shogi/shogi.rb:79 +msgid "MiniShogi" +msgstr "Minishogi" + #: lib/theme_prefs.rb:24 msgid "&Games" msgstr "&Giochi" -- 2.11.4.GIT