mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 21:27:01 -04:00
Localisation, using Locale class
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@113 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -0,0 +1,119 @@
|
|||||||
|
full name: English
|
||||||
|
|
||||||
|
############################################################## Menu items
|
||||||
|
menu
|
||||||
|
file: &File
|
||||||
|
new: &New... Ctrl+N
|
||||||
|
open: &Open... Ctrl+O
|
||||||
|
save: &Save Ctrl+S
|
||||||
|
save as: Save &As... F12
|
||||||
|
export: &Export
|
||||||
|
exit: &Exit Alt+F4
|
||||||
|
|
||||||
|
edit: &Edit
|
||||||
|
undo: &Undo Ctrl+Z
|
||||||
|
redo: &Redo Ctrl+Y
|
||||||
|
cut: Cu&t Ctrl+X
|
||||||
|
copy: &Copy Ctrl+C
|
||||||
|
paste: &Paste Ctrl+V
|
||||||
|
|
||||||
|
cards: &Cards
|
||||||
|
rotate 270: Rotated 90° &Clockwise
|
||||||
|
|
||||||
|
format: &Format
|
||||||
|
bold: &Bold Ctrl+B
|
||||||
|
italic: &Italic Ctrl+I
|
||||||
|
symbols: &Symbols Ctrl+M
|
||||||
|
reminder text: &Reminder Text Ctrl+R
|
||||||
|
|
||||||
|
window: &Window
|
||||||
|
new window: &New Window
|
||||||
|
cards tab: &Cards
|
||||||
|
|
||||||
|
help: &Help
|
||||||
|
|
||||||
|
############################################################## Menu help texts
|
||||||
|
help:
|
||||||
|
new: Create a new set
|
||||||
|
bold: Makes the selected text bold
|
||||||
|
italic: Makes the selected text italic
|
||||||
|
|
||||||
|
############################################################## Tooltips
|
||||||
|
tool:
|
||||||
|
remove card: Remove selected card
|
||||||
|
rotated card: Rotate card
|
||||||
|
|
||||||
|
############################################################## Labels in the GUI
|
||||||
|
label:
|
||||||
|
card notes: Card notes:
|
||||||
|
|
||||||
|
############################################################## Buttons in the GUI
|
||||||
|
button:
|
||||||
|
use for all cards: Use for &all cards
|
||||||
|
|
||||||
|
############################################################## Action (undo/redo) names
|
||||||
|
action:
|
||||||
|
typing: Typing
|
||||||
|
backspace: Backspace
|
||||||
|
delete: Delete
|
||||||
|
change: Change %s
|
||||||
|
|
||||||
|
############################################################## Error messages
|
||||||
|
error:
|
||||||
|
# General
|
||||||
|
internal error:
|
||||||
|
An internal error occured:
|
||||||
|
|
||||||
|
%s
|
||||||
|
|
||||||
|
Please save your work (use 'save as' to so you don't overwrite things)
|
||||||
|
and restart Magic Set Editor.
|
||||||
|
|
||||||
|
You should leave a bug report on http://magicseteditor.sourceforge.net/
|
||||||
|
|
||||||
|
# File related
|
||||||
|
file not found: File not found: '%s' in package '%s'
|
||||||
|
file parse error:
|
||||||
|
Error while parsing file: '%s'
|
||||||
|
%s
|
||||||
|
package not found: Package not found: '%s'
|
||||||
|
unable to open output file: Error while saving, unable to open output file
|
||||||
|
unable to store file: Error while saving, unable to store file
|
||||||
|
|
||||||
|
# Script stuff
|
||||||
|
collection has no member: Collection has no member '%s'
|
||||||
|
object has no member: Object has no member '%s'
|
||||||
|
|
||||||
|
# Image stuff
|
||||||
|
coordinates for blending overlap: Coordinates for blending overlap
|
||||||
|
images used for blending must have the same size: Images used for blending must have the same size
|
||||||
|
|
||||||
|
# Error from files
|
||||||
|
no game specified for the set: No game specified for the set
|
||||||
|
no stylesheet specified for the set: No stylesheet specified for the set
|
||||||
|
stylesheet and set refer to different game:
|
||||||
|
stylesheet and set don't refer to the same game, this is an error in the stylesheet file
|
||||||
|
unsupported fill type: Unsupported fill type: '%s'
|
||||||
|
unrecognized value: Unrecognized value: '%s'
|
||||||
|
newer version:
|
||||||
|
%s
|
||||||
|
This file is made with a newer version of Magic Set Editor (%s)
|
||||||
|
When you open it, some aspects of the file may be lost.
|
||||||
|
It is recommended that you upgrade to the latest version.
|
||||||
|
Visit http:://magicseteditor.sourceforge.net/
|
||||||
|
|
||||||
|
############################################################## Types used in scripts
|
||||||
|
type:
|
||||||
|
real: Real number
|
||||||
|
integer: Integer number
|
||||||
|
string: String
|
||||||
|
|
||||||
|
############################################################## Magic
|
||||||
|
game:
|
||||||
|
magic:
|
||||||
|
name: Name
|
||||||
|
cc: CC
|
||||||
|
type: Type
|
||||||
|
p/t: P/T
|
||||||
|
rarity: Rarity
|
||||||
|
card name: Card Name
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
// ----------------------------------------------------------------------------- : ValueAction
|
// ----------------------------------------------------------------------------- : ValueAction
|
||||||
|
|
||||||
String ValueAction::getName(bool to_undo) const {
|
String ValueAction::getName(bool to_undo) const {
|
||||||
return _("Change ") + valueP->fieldP->name;
|
return String::Format(_ACTION_("change"), valueP->fieldP->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Simple
|
// ----------------------------------------------------------------------------- : Simple
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||||
|
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||||
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Includes
|
||||||
|
|
||||||
|
#include <data/locale.hpp>
|
||||||
|
#include <util/io/package_manager.hpp>
|
||||||
|
#include <script/value.hpp>
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Locale class
|
||||||
|
|
||||||
|
LocaleP the_locale;
|
||||||
|
|
||||||
|
String Locale::typeName() const { return _("locale"); }
|
||||||
|
|
||||||
|
LocaleP Locale::byName(const String& name) {
|
||||||
|
return packages.open<Locale>(name + _(".mse-locale"));
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_REFLECTION(Locale) {
|
||||||
|
REFLECT(full_name);
|
||||||
|
REFLECT_N("menu", translations[LOCALE_CAT_MENU]);
|
||||||
|
REFLECT_N("help", translations[LOCALE_CAT_HELP]);
|
||||||
|
REFLECT_N("tool", translations[LOCALE_CAT_TOOL]);
|
||||||
|
REFLECT_N("label", translations[LOCALE_CAT_LABEL]);
|
||||||
|
REFLECT_N("button", translations[LOCALE_CAT_BUTTON]);
|
||||||
|
REFLECT_N("action", translations[LOCALE_CAT_ACTION]);
|
||||||
|
REFLECT_N("error", translations[LOCALE_CAT_ERROR]);
|
||||||
|
REFLECT_N("type", translations[LOCALE_CAT_TYPE]);
|
||||||
|
REFLECT_N("game", game_translations);
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_REFLECTION_NAMELESS(GameLocale) {
|
||||||
|
REFLECT_NAMELESS(translations);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Translation
|
||||||
|
|
||||||
|
// from util/locale.hpp
|
||||||
|
|
||||||
|
String tr(LocaleCategory cat, const String& key) {
|
||||||
|
if (!the_locale) return key; // no locale loaded (yet)
|
||||||
|
map<String,String>::const_iterator it = the_locale->translations[cat].find(key);
|
||||||
|
if (it == the_locale->translations[cat].end()) return _("missing:") + key;
|
||||||
|
return it->second;
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||||
|
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||||
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
#ifndef HEADER_DATA_LOCALE
|
||||||
|
#define HEADER_DATA_LOCALE
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Includes
|
||||||
|
|
||||||
|
#include <util/prec.hpp>
|
||||||
|
#include <util/locale.hpp>
|
||||||
|
#include <util/reflect.hpp>
|
||||||
|
#include <util/io/package.hpp>
|
||||||
|
|
||||||
|
DECLARE_POINTER_TYPE(Locale);
|
||||||
|
DECLARE_POINTER_TYPE(GameLocale);
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Locale class
|
||||||
|
|
||||||
|
/// Translations of the texts of a game
|
||||||
|
class GameLocale {
|
||||||
|
public:
|
||||||
|
map<String,String> translations;
|
||||||
|
DECLARE_REFLECTION();
|
||||||
|
};
|
||||||
|
|
||||||
|
/// A collection of translations of messages
|
||||||
|
class Locale : public Packaged {
|
||||||
|
public:
|
||||||
|
/// Name of this locale
|
||||||
|
String full_name;
|
||||||
|
/// Translations of UI strings in each category
|
||||||
|
map<String,String> translations[LOCALE_CAT_MAX];
|
||||||
|
/// Translations of game specific texts, by game name
|
||||||
|
map<String,GameLocaleP> game_translations;
|
||||||
|
|
||||||
|
/// Open a locale with the given name
|
||||||
|
static LocaleP byName(const String& name);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
String typeName() const;
|
||||||
|
DECLARE_REFLECTION();
|
||||||
|
};
|
||||||
|
|
||||||
|
/// The global locale object
|
||||||
|
extern LocaleP the_locale;
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : EOF
|
||||||
|
#endif
|
||||||
+3
-3
@@ -77,14 +77,14 @@ void fix_value_207(const ValueP& value) {
|
|||||||
void Set::validate(Version file_app_version) {
|
void Set::validate(Version file_app_version) {
|
||||||
// are the
|
// are the
|
||||||
if (!game) {
|
if (!game) {
|
||||||
throw Error(_("No game specified for the set"));
|
throw Error(_ERROR_("no game specified for the set"));
|
||||||
}
|
}
|
||||||
if (!stylesheet) {
|
if (!stylesheet) {
|
||||||
// TODO : Allow user to select a different style
|
// TODO : Allow user to select a different style
|
||||||
throw Error(_("No stylesheet specified for the set"));
|
throw Error(_ERROR_("no stylesheet specified for the set"));
|
||||||
}
|
}
|
||||||
if (stylesheet->game != game) {
|
if (stylesheet->game != game) {
|
||||||
throw Error(_("stylesheet and set don't refer to the same game, this is an error in the stylesheet file"));
|
throw Error(_ERROR_("stylesheet and set refer to different game"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is our chance to fix version incompatabilities
|
// This is our chance to fix version incompatabilities
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ Settings::Settings()
|
|||||||
, card_notes_height (40)
|
, card_notes_height (40)
|
||||||
, updates_url (_("http://magicseteditor.sourceforge.net/updates"))
|
, updates_url (_("http://magicseteditor.sourceforge.net/updates"))
|
||||||
, check_updates (CHECK_IF_CONNECTED)
|
, check_updates (CHECK_IF_CONNECTED)
|
||||||
|
, locale (_("en"))
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void Settings::addRecentFile(const String& filename) {
|
void Settings::addRecentFile(const String& filename) {
|
||||||
@@ -147,6 +148,7 @@ String Settings::settingsFile() {
|
|||||||
IMPLEMENT_REFLECTION(Settings) {
|
IMPLEMENT_REFLECTION(Settings) {
|
||||||
tag.addAlias(300, _("style settings"), _("stylesheet settings"));
|
tag.addAlias(300, _("style settings"), _("stylesheet settings"));
|
||||||
tag.addAlias(300, _("default style settings"), _("default stylesheet settings"));
|
tag.addAlias(300, _("default style settings"), _("default stylesheet settings"));
|
||||||
|
REFLECT(locale);
|
||||||
REFLECT(recent_sets);
|
REFLECT(recent_sets);
|
||||||
REFLECT(set_window_maximized);
|
REFLECT(set_window_maximized);
|
||||||
REFLECT(set_window_width);
|
REFLECT(set_window_width);
|
||||||
|
|||||||
@@ -83,6 +83,10 @@ class Settings {
|
|||||||
/// Default constructor initializes default settings
|
/// Default constructor initializes default settings
|
||||||
Settings();
|
Settings();
|
||||||
|
|
||||||
|
// --------------------------------------------------- : Locale
|
||||||
|
|
||||||
|
String locale;
|
||||||
|
|
||||||
// --------------------------------------------------- : Recently opened sets
|
// --------------------------------------------------- : Recently opened sets
|
||||||
vector<String> recent_sets;
|
vector<String> recent_sets;
|
||||||
static const UInt max_recent_sets = 4; // store this many recent sets
|
static const UInt max_recent_sets = 4; // store this many recent sets
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ template <typename T> inline T sqr(T x) { return x * x; }
|
|||||||
void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2,double y2) {
|
void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2,double y2) {
|
||||||
int width = img1.GetWidth(), height = img1.GetHeight();
|
int width = img1.GetWidth(), height = img1.GetHeight();
|
||||||
if (img2.GetWidth() != width || img2.GetHeight() != height) {
|
if (img2.GetWidth() != width || img2.GetHeight() != height) {
|
||||||
throw Error(_("Images used for blending must have the same size"));
|
throw Error(_ERROR_("images used for blending must have the same size"));
|
||||||
}
|
}
|
||||||
|
|
||||||
const int fixed = 1<<16; // fixed point multiplier
|
const int fixed = 1<<16; // fixed point multiplier
|
||||||
@@ -35,7 +35,7 @@ void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2
|
|||||||
// (using dx = x1-x2, dy = y1-y2)
|
// (using dx = x1-x2, dy = y1-y2)
|
||||||
// a = fixed / (w^2 dx^2 + h^2 dy^2)
|
// a = fixed / (w^2 dx^2 + h^2 dy^2)
|
||||||
// d = a * (w^2 x1 dx + h^2 y1 dy)
|
// d = a * (w^2 x1 dx + h^2 y1 dy)
|
||||||
if (x1==x2 && y1==y2) throw Error(_("Coordinates for blending overlap"));
|
if (x1==x2 && y1==y2) throw Error(_ERROR_("coordinates for blending overlap"));
|
||||||
double a = fixed / (sqr(width) * sqr(x1-x2) + sqr(height) * sqr(y1-y2));
|
double a = fixed / (sqr(width) * sqr(x1-x2) + sqr(height) * sqr(y1-y2));
|
||||||
int xm = (x2 - x1) * width * a;
|
int xm = (x2 - x1) * width * a;
|
||||||
int ym = (y2 - y1) * height * a;
|
int ym = (y2 - y1) * height * a;
|
||||||
|
|||||||
@@ -0,0 +1,108 @@
|
|||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||||
|
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||||
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Includes
|
||||||
|
|
||||||
|
#include <gui/control/text_ctrl.hpp>
|
||||||
|
#include <gui/value/editor.hpp>
|
||||||
|
#include <gui/util.hpp>
|
||||||
|
#include <data/field/text.hpp>
|
||||||
|
#include <data/action/value.hpp>
|
||||||
|
|
||||||
|
DECLARE_TYPEOF_COLLECTION(ValueViewerP);
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : TextCtrl
|
||||||
|
|
||||||
|
TextCtrl::TextCtrl(Window* parent, int id, long style)
|
||||||
|
: DataEditor(parent, id, style)
|
||||||
|
, value(nullptr)
|
||||||
|
{}
|
||||||
|
|
||||||
|
Rotation TextCtrl::getRotation() const {
|
||||||
|
return Rotation(0, RealRect(RealPoint(0,0),GetClientSize()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextCtrl::draw(DC& dc) {
|
||||||
|
RotatedDC rdc(dc, getRotation(), false);
|
||||||
|
DataViewer::draw(rdc, wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||||
|
}
|
||||||
|
void TextCtrl::drawViewer(RotatedDC& dc, ValueViewer& v) {
|
||||||
|
// draw background
|
||||||
|
Style& s = *v.getStyle();
|
||||||
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
dc.SetBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
|
||||||
|
dc.DrawRectangle(s.getRect().grow(1));
|
||||||
|
// draw viewer
|
||||||
|
v.draw(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TextCtrl::setValue(String* value) {
|
||||||
|
this->value = value;
|
||||||
|
if (viewers.empty() && value) {
|
||||||
|
// create a field, style and value
|
||||||
|
TextFieldP field(new TextField);
|
||||||
|
TextStyleP style(new TextStyle(field));
|
||||||
|
TextValueP value(new TextValue(field));
|
||||||
|
// set stuff
|
||||||
|
field->index = 0;
|
||||||
|
style->width = 100;
|
||||||
|
style->height = 20;
|
||||||
|
style->left = style->top = 1;
|
||||||
|
value->value.assign(*this->value);
|
||||||
|
// assign to this control
|
||||||
|
IndexMap<FieldP,StyleP> styles; styles.add(field, style);
|
||||||
|
IndexMap<FieldP,ValueP> values; values.add(field, value);
|
||||||
|
setStyles(styles);
|
||||||
|
setData(values);
|
||||||
|
// determine required height
|
||||||
|
viewers.front()->getEditor()->determineSize();
|
||||||
|
SetMinSize(wxSize(style->width + 6, style->height + 6));
|
||||||
|
}
|
||||||
|
valueChanged();
|
||||||
|
}
|
||||||
|
void TextCtrl::valueChanged() {
|
||||||
|
if (!viewers.empty()) {
|
||||||
|
TextValue& tv = static_cast<TextValue&>(*viewers.front()->getValue());
|
||||||
|
tv.value.assign(value ? *value : wxEmptyString);
|
||||||
|
viewers.front()->onValueChange();
|
||||||
|
}
|
||||||
|
onChange();
|
||||||
|
}
|
||||||
|
void TextCtrl::onAction(const Action& action, bool undone) {
|
||||||
|
DataEditor::onAction(action, undone);
|
||||||
|
TYPE_CASE(action, TextValueAction) {
|
||||||
|
TextValue& tv = static_cast<TextValue&>(*viewers.front()->getValue());
|
||||||
|
if (&tv == action.valueP.get()) {
|
||||||
|
// the value has changed
|
||||||
|
if (value) *value = tv.value();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
void TextCtrl::onChangeSet() {
|
||||||
|
DataEditor::onChangeSet();
|
||||||
|
setValue(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextCtrl::onInit() {
|
||||||
|
// Give viewers a chance to show/hide controls (scrollbar) when selecting other editors
|
||||||
|
FOR_EACH_EDITOR {
|
||||||
|
e->onShow(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TextCtrl::onSize(wxSizeEvent&) {
|
||||||
|
if (!viewers.empty()) {
|
||||||
|
wxSize cs = GetClientSize();
|
||||||
|
Style& style = *viewers.front()->getStyle();
|
||||||
|
style.width = cs.GetWidth() - 2;
|
||||||
|
style.height = cs.GetHeight() - 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(TextCtrl, DataEditor)
|
||||||
|
EVT_SIZE (TextCtrl::onSize)
|
||||||
|
END_EVENT_TABLE()
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||||
|
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||||
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
#ifndef HEADER_GUI_CONTROL_TEXT_CTRL
|
||||||
|
#define HEADER_GUI_CONTROL_TEXT_CTRL
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Includes
|
||||||
|
|
||||||
|
#include <util/prec.hpp>
|
||||||
|
#include <gui/control/card_editor.hpp>
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : TextCtrl
|
||||||
|
|
||||||
|
/// A control for editing a String
|
||||||
|
/** Implemented using a DataEditor. A fake Field and Value are created for the item.
|
||||||
|
*
|
||||||
|
* TODO:
|
||||||
|
* Possible problem: If multiple TextCtrls are editing the same value they will both
|
||||||
|
* create a Value, actions modifying one of them will not match with actions modifying the other
|
||||||
|
* Possible solution: 1. Global map of Values
|
||||||
|
* 2. Ignore the problem, it will not happen in practice
|
||||||
|
*/
|
||||||
|
class TextCtrl : public DataEditor {
|
||||||
|
public:
|
||||||
|
TextCtrl(Window* parent, int id, long style = 0);
|
||||||
|
|
||||||
|
/// Set the value that is being edited
|
||||||
|
void setValue(String* value);
|
||||||
|
/// Notification that the value has changed outside this control
|
||||||
|
void valueChanged();
|
||||||
|
|
||||||
|
/// Uses a native look
|
||||||
|
virtual bool nativeLook() const { return true; }
|
||||||
|
virtual bool drawBorders() const { return false; }
|
||||||
|
virtual Rotation getRotation() const;
|
||||||
|
|
||||||
|
virtual void draw(DC& dc);
|
||||||
|
virtual void drawViewer(RotatedDC& dc, ValueViewer& v);
|
||||||
|
|
||||||
|
/// When an action is received, change the underlying value
|
||||||
|
virtual void onAction(const Action&, bool undone);
|
||||||
|
virtual void onChangeSet();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void onInit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
String* value; ///< Value to edit
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE();
|
||||||
|
|
||||||
|
void onSize(wxSizeEvent&);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : EOF
|
||||||
|
#endif
|
||||||
@@ -35,7 +35,7 @@ CardsPanel::CardsPanel(Window* parent, int id)
|
|||||||
notes = new TextCtrl(notesP, ID_NOTES);
|
notes = new TextCtrl(notesP, ID_NOTES);
|
||||||
// init sizer for notes panel
|
// init sizer for notes panel
|
||||||
wxSizer* sn = new wxBoxSizer(wxVERTICAL);
|
wxSizer* sn = new wxBoxSizer(wxVERTICAL);
|
||||||
sn->Add(new wxStaticText(notesP, wxID_ANY, _("Card notes:")), 0, wxEXPAND, 2);
|
sn->Add(new wxStaticText(notesP, wxID_ANY, _LABEL_("card notes")), 0, wxEXPAND, 2);
|
||||||
sn->Add(notes, 1, wxEXPAND | wxTOP, 2);
|
sn->Add(notes, 1, wxEXPAND | wxTOP, 2);
|
||||||
notesP->SetSizer(sn);
|
notesP->SetSizer(sn);
|
||||||
// init splitter
|
// init splitter
|
||||||
@@ -68,15 +68,15 @@ void CardsPanel::onChangeSet() {
|
|||||||
|
|
||||||
void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
|
void CardsPanel::initUI(wxToolBar* tb, wxMenuBar* mb) {
|
||||||
// Toolbar
|
// Toolbar
|
||||||
tb->AddTool(ID_FORMAT_BOLD, _(""), Bitmap(_("TOOL_BOLD")), wxNullBitmap, wxITEM_CHECK, _("Bold"));
|
tb->AddTool(ID_FORMAT_BOLD, _(""), Bitmap(_("TOOL_BOLD")), wxNullBitmap, wxITEM_CHECK, _TOOL_("bold"));
|
||||||
tb->AddTool(ID_FORMAT_ITALIC, _(""), Bitmap(_("TOOL_ITALIC")), wxNullBitmap, wxITEM_CHECK, _("Italic"));
|
tb->AddTool(ID_FORMAT_ITALIC, _(""), Bitmap(_("TOOL_ITALIC")), wxNullBitmap, wxITEM_CHECK, _TOOL_("italic"));
|
||||||
tb->AddTool(ID_FORMAT_SYMBOL, _(""), Bitmap(_("TOOL_SYMBOL")), wxNullBitmap, wxITEM_CHECK, _("Symbols"));
|
tb->AddTool(ID_FORMAT_SYMBOL, _(""), Bitmap(_("TOOL_SYMBOL")), wxNullBitmap, wxITEM_CHECK, _TOOL_("symbols"));
|
||||||
tb->AddTool(ID_FORMAT_REMINDER, _(""), Bitmap(_("TOOL_REMINDER")), wxNullBitmap, wxITEM_CHECK, _("Reminder Text"));
|
tb->AddTool(ID_FORMAT_REMINDER, _(""), Bitmap(_("TOOL_REMINDER")), wxNullBitmap, wxITEM_CHECK, _TOOL_("reminder text"));
|
||||||
tb->AddSeparator();
|
tb->AddSeparator();
|
||||||
tb->AddTool(ID_CARD_ADD, _(""), Bitmap(_("TOOL_CARD_ADD")), wxNullBitmap, wxITEM_NORMAL,_("Add card"));
|
tb->AddTool(ID_CARD_ADD, _(""), Bitmap(_("TOOL_CARD_ADD")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("add card"));
|
||||||
tb->AddTool(ID_CARD_REMOVE, _(""), Bitmap(_("TOOL_CARD_DEl")), wxNullBitmap, wxITEM_NORMAL,_("Remove selected card"));
|
tb->AddTool(ID_CARD_REMOVE, _(""), Bitmap(_("TOOL_CARD_DEl")), wxNullBitmap, wxITEM_NORMAL,_TOOL_("remove card"));
|
||||||
tb->AddSeparator();
|
tb->AddSeparator();
|
||||||
tb->AddTool(ID_CARD_ROTATE, _(""), Bitmap(_("TOOL_CARD_ROTATE")),wxNullBitmap,wxITEM_NORMAL,_("Rotate card"));
|
tb->AddTool(ID_CARD_ROTATE, _(""), Bitmap(_("TOOL_CARD_ROTATE")),wxNullBitmap,wxITEM_NORMAL,_TOOL_("rotate card"));
|
||||||
tb->Realize();
|
tb->Realize();
|
||||||
// Menus
|
// Menus
|
||||||
IconMenu* menuCard = new IconMenu();
|
IconMenu* menuCard = new IconMenu();
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ SetWindow::SetWindow(Window* parent, const SetP& set)
|
|||||||
// recent files go here
|
// recent files go here
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(ID_FILE_EXIT, _("E&xit\tAlt+F4"), _("Quits Magic Set Editor; prompts to save the set"));
|
menuFile->Append(ID_FILE_EXIT, _("E&xit\tAlt+F4"), _("Quits Magic Set Editor; prompts to save the set"));
|
||||||
menuBar->Append(menuFile, _("&File"));
|
menuBar->Append(menuFile, _MENU_("file"));
|
||||||
|
|
||||||
IconMenu* menuEdit = new IconMenu();
|
IconMenu* menuEdit = new IconMenu();
|
||||||
menuEdit->Append(ID_EDIT_UNDO, _("TOOL_UNDO"), _("&Undo\tCtrl+Z"), _("Undoes the last action"));
|
menuEdit->Append(ID_EDIT_UNDO, _("TOOL_UNDO"), _("&Undo\tCtrl+Z"), _("Undoes the last action"));
|
||||||
|
|||||||
+3
-3
@@ -76,13 +76,13 @@ Image load_resource_image(const String& name) {
|
|||||||
// based on wxLoadUserResource
|
// based on wxLoadUserResource
|
||||||
// The image can be in an IMAGE resource, in any file format
|
// The image can be in an IMAGE resource, in any file format
|
||||||
HRSRC hResource = ::FindResource(wxGetInstance(), name, _("IMAGE"));
|
HRSRC hResource = ::FindResource(wxGetInstance(), name, _("IMAGE"));
|
||||||
if ( hResource == 0 ) throw InternalError(_("Resource not found: ") + name);
|
if ( hResource == 0 ) throw InternalError(String::Format(_("Resource not found: %s"), name));
|
||||||
|
|
||||||
HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
|
HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
|
||||||
if ( hData == 0 ) throw InternalError(_("Resource not an image: ") + name);
|
if ( hData == 0 ) throw InternalError(String::Format(_("Resource not an image: %s"), name));
|
||||||
|
|
||||||
char* data = (char *)::LockResource(hData);
|
char* data = (char *)::LockResource(hData);
|
||||||
if ( !data ) throw InternalError(_("Resource cannot be locked: ") + name);
|
if ( !data ) throw InternalError(String::Format(_("Resource cannot be locked: %s"), name));
|
||||||
|
|
||||||
int len = ::SizeofResource(wxGetInstance(), hResource);
|
int len = ::SizeofResource(wxGetInstance(), hResource);
|
||||||
wxMemoryInputStream stream(data, len);
|
wxMemoryInputStream stream(data, len);
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <data/game.hpp>
|
#include <data/game.hpp>
|
||||||
#include <data/set.hpp>
|
#include <data/set.hpp>
|
||||||
#include <data/settings.hpp>
|
#include <data/settings.hpp>
|
||||||
|
#include <data/locale.hpp>
|
||||||
#include <data/format/formats.hpp>
|
#include <data/format/formats.hpp>
|
||||||
#include <gui/welcome_window.hpp>
|
#include <gui/welcome_window.hpp>
|
||||||
#include <gui/update_checker.hpp>
|
#include <gui/update_checker.hpp>
|
||||||
@@ -45,6 +46,7 @@ bool MSE::OnInit() {
|
|||||||
init_file_formats();
|
init_file_formats();
|
||||||
packages.init();
|
packages.init();
|
||||||
settings.read();
|
settings.read();
|
||||||
|
the_locale = Locale::byName(settings.locale);
|
||||||
// check for updates
|
// check for updates
|
||||||
check_updates();
|
check_updates();
|
||||||
//Window* wnd = new SymbolWindow(nullptr);
|
//Window* wnd = new SymbolWindow(nullptr);
|
||||||
|
|||||||
@@ -1210,6 +1210,48 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\data\keyword.hpp">
|
RelativePath=".\data\keyword.hpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\data\locale.cpp">
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug Unicode|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release Unicode|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release Profile Unicode|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release Unicode fast build|Win32">
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
ObjectFile="$(IntDir)/$(InputName)1.obj"/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\data\locale.hpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\data\set.cpp">
|
RelativePath=".\data\set.cpp">
|
||||||
</File>
|
</File>
|
||||||
@@ -1734,6 +1776,9 @@
|
|||||||
<File
|
<File
|
||||||
RelativePath=".\util\index_map.hpp">
|
RelativePath=".\util\index_map.hpp">
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath=".\util\locale.hpp">
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath=".\util\real_point.hpp">
|
RelativePath=".\util\real_point.hpp">
|
||||||
</File>
|
</File>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ shared_ptr<SymbolFilter> read_new<SymbolFilter>(Reader& reader) {
|
|||||||
else if (fill_type == _("linear gradient")) return new_shared<LinearGradientSymbolFilter>();
|
else if (fill_type == _("linear gradient")) return new_shared<LinearGradientSymbolFilter>();
|
||||||
else if (fill_type == _("radial gradient")) return new_shared<RadialGradientSymbolFilter>();
|
else if (fill_type == _("radial gradient")) return new_shared<RadialGradientSymbolFilter>();
|
||||||
else {
|
else {
|
||||||
throw ParseError(_("Unsupported fill type: '") + fill_type + _("'"));
|
throw ParseError(_ERROR_1_("unsupported fill type", fill_type));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ ScriptValueP get_member(const map<String,V>& m, const String& name) {
|
|||||||
if (it != m.end()) {
|
if (it != m.end()) {
|
||||||
return toScript(it->second);
|
return toScript(it->second);
|
||||||
} else {
|
} else {
|
||||||
throw ScriptError(_("Collection has no member '") + name + _("'"));
|
throw ScriptError(_ERROR_1_("collection has no member", name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -195,7 +195,7 @@ ScriptValueP get_member(const IndexMap<K,V>& m, const String& name) {
|
|||||||
if (it != m.end()) {
|
if (it != m.end()) {
|
||||||
return toScript(*it);
|
return toScript(*it);
|
||||||
} else {
|
} else {
|
||||||
throw ScriptError(_("Collection has no member '") + name + _("'"));
|
throw ScriptError(_ERROR_1_("collection has no member", name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ class ScriptObject : public ScriptValue {
|
|||||||
if (d) {
|
if (d) {
|
||||||
return d->getMember(name);
|
return d->getMember(name);
|
||||||
} else {
|
} else {
|
||||||
throw ScriptError(_("Object has no member '") + name + _("'"));
|
throw ScriptError(_ERROR_1_("object has no member", name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-4
@@ -36,8 +36,7 @@ class Error {
|
|||||||
class InternalError : public Error {
|
class InternalError : public Error {
|
||||||
public:
|
public:
|
||||||
inline InternalError(const String& str)
|
inline InternalError(const String& str)
|
||||||
: Error(_("An internal error occured:\n\n") + str
|
: Error(_ERROR_1_("internal error",str))
|
||||||
+_("\n\nPlease save your work (use 'save as' to so you don't overwrite things),\n and restart Magic Set Editor.\n\nYou should leave a bug report on http://magicseteditor.sourceforge.net/"))
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -53,7 +52,7 @@ class PackageError : public Error {
|
|||||||
class FileNotFoundError : public PackageError {
|
class FileNotFoundError : public PackageError {
|
||||||
public:
|
public:
|
||||||
inline FileNotFoundError(const String& file, const String& package)
|
inline FileNotFoundError(const String& file, const String& package)
|
||||||
: PackageError(_("File not found: ") + file + _(" in package ") + package)
|
: PackageError(_ERROR_2_("file not found",file,package))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -69,7 +68,7 @@ class ParseError : public Error {
|
|||||||
class FileParseError : public ParseError {
|
class FileParseError : public ParseError {
|
||||||
public:
|
public:
|
||||||
inline FileParseError(const String& err, const String& file) :
|
inline FileParseError(const String& err, const String& file) :
|
||||||
ParseError(_("Error while parsing file '") + file + _("':\n") + err)
|
ParseError(_ERROR_2_("file parse error",file,err))
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -308,9 +308,9 @@ void Package::openZipfile() {
|
|||||||
delete zipStream; zipStream = nullptr;
|
delete zipStream; zipStream = nullptr;
|
||||||
// open streams
|
// open streams
|
||||||
fileStream = new wxFileInputStream(filename);
|
fileStream = new wxFileInputStream(filename);
|
||||||
if (!fileStream->IsOk()) throw PackageError(_("Package not found: '")+filename+_("'"));
|
if (!fileStream->IsOk()) throw PackageError(_ERROR_1_("package not found", filename));
|
||||||
zipStream = new wxZipInputStream(*fileStream);
|
zipStream = new wxZipInputStream(*fileStream);
|
||||||
if (!zipStream->IsOk()) throw PackageError(_("Package not found: '")+filename+_("'"));
|
if (!zipStream->IsOk()) throw PackageError(_ERROR_1_("package not found", filename));
|
||||||
// read zip entries
|
// read zip entries
|
||||||
while (true) {
|
while (true) {
|
||||||
wxZipEntry* entry = zipStream->GetNextEntry();
|
wxZipEntry* entry = zipStream->GetNextEntry();
|
||||||
@@ -333,12 +333,12 @@ void Package::saveToDirectory(const String& saveAs, bool removeUnused) {
|
|||||||
// move files that were updated
|
// move files that were updated
|
||||||
wxRemoveFile(saveAs+_("/")+f.first);
|
wxRemoveFile(saveAs+_("/")+f.first);
|
||||||
if (!wxRenameFile(f.second.tempName, saveAs+_("/")+f.first)) {
|
if (!wxRenameFile(f.second.tempName, saveAs+_("/")+f.first)) {
|
||||||
throw PackageError(_("Error while saving, unable to store file"));
|
throw PackageError(_ERROR_("unable to store file"));
|
||||||
}
|
}
|
||||||
} else if (filename != saveAs) {
|
} else if (filename != saveAs) {
|
||||||
// save as, copy old filess
|
// save as, copy old filess
|
||||||
if (!wxCopyFile(filename+_("/")+f.first, saveAs+_("/")+f.first)) {
|
if (!wxCopyFile(filename+_("/")+f.first, saveAs+_("/")+f.first)) {
|
||||||
throw PackageError(_("Error while saving, unable to store file"));
|
throw PackageError(_ERROR_("unable to store file"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// old file, just keep it
|
// old file, just keep it
|
||||||
@@ -353,9 +353,9 @@ void Package::saveToZipfile(const String& saveAs, bool removeUnused) {
|
|||||||
// open zip file
|
// open zip file
|
||||||
try {
|
try {
|
||||||
scoped_ptr<wxFileOutputStream> newFile(new wxFileOutputStream(tempFile));
|
scoped_ptr<wxFileOutputStream> newFile(new wxFileOutputStream(tempFile));
|
||||||
if (!newFile->IsOk()) throw PackageError(_("Error while saving, unable to open output file"));
|
if (!newFile->IsOk()) throw PackageError(_ERROR_("unable to open output file"));
|
||||||
scoped_ptr<wxZipOutputStream> newZip(new wxZipOutputStream(*newFile));
|
scoped_ptr<wxZipOutputStream> newZip(new wxZipOutputStream(*newFile));
|
||||||
if (!newZip->IsOk()) throw PackageError(_("Error while saving, unable to open output file"));
|
if (!newZip->IsOk()) throw PackageError(_ERROR_("unable to open output file"));
|
||||||
// copy everything to a new zip file, unless it's updated or removed
|
// copy everything to a new zip file, unless it's updated or removed
|
||||||
if (zipStream) newZip->CopyArchiveMetaData(*zipStream);
|
if (zipStream) newZip->CopyArchiveMetaData(*zipStream);
|
||||||
FOR_EACH(f, files) {
|
FOR_EACH(f, files) {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
#include <data/game.hpp>
|
#include <data/game.hpp>
|
||||||
#include <data/stylesheet.hpp>
|
#include <data/stylesheet.hpp>
|
||||||
#include <data/symbol_font.hpp>
|
#include <data/symbol_font.hpp>
|
||||||
|
#include <data/locale.hpp>
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : IncludePackage
|
// ----------------------------------------------------------------------------- : IncludePackage
|
||||||
@@ -68,7 +69,7 @@ PackagedP PackageManager::openAny(const String& name) {
|
|||||||
// load with the right type, based on extension
|
// load with the right type, based on extension
|
||||||
if (fn.GetExt() == _("mse-game")) p = new_shared<Game>();
|
if (fn.GetExt() == _("mse-game")) p = new_shared<Game>();
|
||||||
else if (fn.GetExt() == _("mse-style")) p = new_shared<StyleSheet>();
|
else if (fn.GetExt() == _("mse-style")) p = new_shared<StyleSheet>();
|
||||||
// else if (fn.GetExt() == _("mse-locale")) p = new_shared<Locale>();
|
else if (fn.GetExt() == _("mse-locale")) p = new_shared<Locale>();
|
||||||
else if (fn.GetExt() == _("mse-include")) p = new_shared<IncludePackage>();
|
else if (fn.GetExt() == _("mse-include")) p = new_shared<IncludePackage>();
|
||||||
else if (fn.GetExt() == _("mse-symbol-font")) p = new_shared<SymbolFont>();
|
else if (fn.GetExt() == _("mse-symbol-font")) p = new_shared<SymbolFont>();
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -42,12 +42,7 @@ void Reader::handleAppVersion() {
|
|||||||
if (enterBlock(_("mse_version"))) {
|
if (enterBlock(_("mse_version"))) {
|
||||||
handle(file_app_version);
|
handle(file_app_version);
|
||||||
if (app_version < file_app_version) {
|
if (app_version < file_app_version) {
|
||||||
wxMessageBox(
|
wxMessageBox(_ERROR_2_("newer version", filename, file_app_version.toString()), _("Warning"), wxOK | wxICON_EXCLAMATION);
|
||||||
filename + _("\n")
|
|
||||||
_("This file is made with a newer version of Magic Set Editor (")+ file_app_version.toString() +_(").\n")
|
|
||||||
_("When you open it, some aspects of the file may be lost.\n")
|
|
||||||
_("It is recommended that you upgrade to the latest version.\n")
|
|
||||||
_("Visit http:://magicseteditor.sourceforge.net/"), _("Warning"), wxOK | wxICON_EXCLAMATION);
|
|
||||||
}
|
}
|
||||||
exitBlock();
|
exitBlock();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -225,7 +225,7 @@ void Reader::handle(IndexMap<K,V>& m) {
|
|||||||
reflect_ ## Enum(enum_, reader); \
|
reflect_ ## Enum(enum_, reader); \
|
||||||
if (!reader.isDone()) { \
|
if (!reader.isDone()) { \
|
||||||
/* warning: unknown value */ \
|
/* warning: unknown value */ \
|
||||||
warning(_("Unrecognized value: ") + value); \
|
warning(_ERROR_1_("unrecognized value", value)); \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
bool parse_enum(const String& value, Enum& out) { \
|
bool parse_enum(const String& value, Enum& out) { \
|
||||||
|
|||||||
@@ -0,0 +1,64 @@
|
|||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
//| Description: Magic Set Editor - Program to make Magic (tm) cards |
|
||||||
|
//| Copyright: (C) 2001 - 2006 Twan van Laarhoven |
|
||||||
|
//| License: GNU General Public License 2 or later (see file COPYING) |
|
||||||
|
//+----------------------------------------------------------------------------+
|
||||||
|
|
||||||
|
#ifndef HEADER_UTIL_LOCALE
|
||||||
|
#define HEADER_UTIL_LOCALE
|
||||||
|
|
||||||
|
/** @file util/locale.hpp
|
||||||
|
*
|
||||||
|
* @brief Utilities for localisation of text.
|
||||||
|
* Whenever text is used that can be translated to another language (and is not code related)
|
||||||
|
* one of the macros from this file should be used
|
||||||
|
*/
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Includes
|
||||||
|
|
||||||
|
#include <util/prec.hpp>
|
||||||
|
#include <util/string.hpp>
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : Localisation macros
|
||||||
|
|
||||||
|
enum LocaleCategory
|
||||||
|
{ LOCALE_CAT_MENU
|
||||||
|
, LOCALE_CAT_HELP
|
||||||
|
, LOCALE_CAT_TOOL
|
||||||
|
, LOCALE_CAT_LABEL
|
||||||
|
, LOCALE_CAT_BUTTON
|
||||||
|
, LOCALE_CAT_TYPE
|
||||||
|
, LOCALE_CAT_ACTION
|
||||||
|
, LOCALE_CAT_ERROR
|
||||||
|
, LOCALE_CAT_MAX
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Translate 'key' in the category 'cat' using the current locale
|
||||||
|
String tr(LocaleCategory cat, const String& key);
|
||||||
|
|
||||||
|
/// A localized string for menus/toolbar buttons
|
||||||
|
#define _MENU_(s) tr(LOCALE_CAT_MENU, _(s))
|
||||||
|
/// A localized string for help/statusbar text
|
||||||
|
#define _HELP_(s) tr(LOCALE_CAT_HELP, _(s))
|
||||||
|
/// A localized string for tooltip text for toolbar buttons
|
||||||
|
#define _TOOL_(s) tr(LOCALE_CAT_TOOL, _(s))
|
||||||
|
/// A localized string for labels
|
||||||
|
#define _LABEL_(s) tr(LOCALE_CAT_LABEL, _(s))
|
||||||
|
/// A localized string for buttons
|
||||||
|
#define _BUTTON_(s) tr(LOCALE_CAT_BUTTON,_(s))
|
||||||
|
/// A localized string for type names in scripts
|
||||||
|
#define _TYPE_(s) tr(LOCALE_CAT_TYPE, _(s))
|
||||||
|
/// A localized string for action names
|
||||||
|
#define _ACTION_(s) tr(LOCALE_CAT_ACTION, _(s))
|
||||||
|
/// A localized string for error messages
|
||||||
|
#define _ERROR_(s) tr(LOCALE_CAT_ERROR, _(s))
|
||||||
|
|
||||||
|
/// A localized string for error messages, with 1 argument (printf style)
|
||||||
|
#define _ERROR_1_(s,a) String::Format(tr(LOCALE_CAT_ERROR, _(s)), a)
|
||||||
|
/// A localized string for error messages, with 2 argument (printf style)
|
||||||
|
#define _ERROR_2_(s,a,b) String::Format(tr(LOCALE_CAT_ERROR, _(s)), a, b)
|
||||||
|
/// A localized string for error messages, with 3 argument (printf style)
|
||||||
|
#define _ERROR_3_(s,a,b,c) String::Format(tr(LOCALE_CAT_ERROR, _(s)), a, b, c)
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------- : EOF
|
||||||
|
#endif
|
||||||
@@ -39,6 +39,7 @@ using namespace std;
|
|||||||
#include "string.hpp"
|
#include "string.hpp"
|
||||||
#include "smart_ptr.hpp"
|
#include "smart_ptr.hpp"
|
||||||
#include "index_map.hpp"
|
#include "index_map.hpp"
|
||||||
|
#include "locale.hpp"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------- : Wx Aliasses
|
// ----------------------------------------------------------------------------- : Wx Aliasses
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user