From 35bbf36e040af21b44d3ac81fc5dc4645950c412 Mon Sep 17 00:00:00 2001 From: twanvl Date: Fri, 17 Aug 2007 21:10:48 +0000 Subject: [PATCH] Added validator for locales based on all strings in the source code. It checks: - whether all keys used by the program are in the locale - whether the right number of %s are used - if there are no extra keys in the locale that shouldn't be there This will become very useful when translations need to be updated for new MSE versions. There is a perl script for generating the 'expected_locale_keys' resource file. This file contains a list of all the locale keys used. This is a resource and not a data file because it is automatically generated from the code, the user has no business modifying it. I also fixed all the locale errors I found in the process. git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@613 0fc631ac-6414-0410-93d0-97cfa31319b6 --- data/en.mse-locale/locale | 17 +- src/data/field.cpp | 2 +- src/data/format/apprentice.cpp | 2 +- src/data/locale.cpp | 150 +++++++ src/data/locale.hpp | 7 + src/gui/control/keyword_list.hpp | 2 +- src/gui/set/window.cpp | 2 +- src/gui/value/text.cpp | 18 +- src/resource/common/expected_locale_keys | 495 +++++++++++++++++++++++ src/resource/msw/mse.rc | 4 + src/script/to_value.hpp | 4 +- src/script/value.cpp | 4 +- src/util/version.hpp | 2 + tools/locale/locale.pl | 104 +++++ 14 files changed, 789 insertions(+), 24 deletions(-) create mode 100644 src/resource/common/expected_locale_keys create mode 100644 tools/locale/locale.pl diff --git a/data/en.mse-locale/locale b/data/en.mse-locale/locale index 8203cdd5..5d413968 100644 --- a/data/en.mse-locale/locale +++ b/data/en.mse-locale/locale @@ -207,7 +207,7 @@ help: overlap: Place this shape, and its border above shapes below it border: Draws this shape as a border - drag to shear: Drag to shear selected shape + drag to shear: Drag to shear selected %s drag to rotate: Drag to rotate selected %s, Ctrl constrains angle to multiples of 15 degrees drag to resize: Drag to resize selected %s, Ctrl constrains size click to select shape: Click to select shape, drag to move shape, double click to edit shape @@ -421,7 +421,7 @@ label: # apprentice export set code: Set &Code: - apprentice export cancled: Export to Apprentice is cancled + apprentice export cancelled: Export to Apprentice is cancelled # Html export html template: Template: @@ -516,7 +516,7 @@ title: print preview: Print Preview # export export images: Export Images - export cancled: Export Cancled + export cancelled: Export Cancelled export html: Export to HTML save html: Export to HTML @@ -530,8 +530,13 @@ title: action: # Text editor typing: Typing + enter: Enter + soft line break: Soft line break + insert symbol: Insert symbol backspace: Backspace delete: Delete + cut: Cut + paste: Paste # Choice/color editors change: Change %s @@ -561,7 +566,7 @@ action: # Symmetry add symmetry: Add symmetry - remove symmetry: Remove symmetry + #remove symmetry: Remove symmetry move symmetry center: Move symmetry center move symmetry handle: Change symmetry orientation change symmetry type: Change symmetry type @@ -597,7 +602,6 @@ error: has no member value: String "%s" has no member '%s' can't convert value: Can't convert "%s" from %s to %s unsupported format: Invalid string format: '%s' - can not sort: I don't know how to sort a %s # Image stuff coordinates for blending overlap: Coordinates for blending overlap @@ -638,7 +642,7 @@ type: collection: collection collection of: collection of %ss object: object - real: real number + double: real number integer: integer number string: string boolean: boolean @@ -675,7 +679,6 @@ type: point: point points: points - handle: handle # Package manager installed: installed diff --git a/src/data/field.cpp b/src/data/field.cpp index 807084ed..28ed6311 100644 --- a/src/data/field.cpp +++ b/src/data/field.cpp @@ -82,7 +82,7 @@ intrusive_ptr read_new(Reader& reader) { reader.warning(_ERROR_1_("expected key", _("type"))); throw ParseError(_ERROR_("aborting parsing")); } else { - reader.warning(_ERROR_1_("Unsupported field type", type)); + reader.warning(_ERROR_1_("unsupported field type", type)); throw ParseError(_ERROR_("aborting parsing")); } } diff --git a/src/data/format/apprentice.cpp b/src/data/format/apprentice.cpp index 164934b0..5316f787 100644 --- a/src/data/format/apprentice.cpp +++ b/src/data/format/apprentice.cpp @@ -697,7 +697,7 @@ void ApprenticeExportWindow::onOk(wxCommandEvent& ev) { } } catch (const AbortException&) { // aborted, cleanup is already handled by dtors - wxMessageBox(_LABEL_("apprentice export cancled"), _TITLE_("export canceled"), wxOK | wxICON_INFORMATION); + wxMessageBox(_LABEL_("apprentice export cancelled"), _TITLE_("export cancelled"), wxOK | wxICON_INFORMATION); } // Done, close progress window progress_target->Hide(); diff --git a/src/data/locale.cpp b/src/data/locale.cpp index c039dcba..9dca1de0 100644 --- a/src/data/locale.cpp +++ b/src/data/locale.cpp @@ -13,6 +13,11 @@ #include #include