diff --git a/CHANGES.md b/CHANGES.md index ec15a69d..c7b0fc20 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -4,6 +4,12 @@ Magic Set Editor changelog, for the details see `git log` HEAD: new items added as changes are made ------------------------------------------------------------------------------ +Features: + * You can now check/uncheck all selected cards in the export window (#93) + +Template features: + * Localization of game/stylesheet/symbol_font names is now done in those templates, instead of via the program-wide locale file. (#100) + ------------------------------------------------------------------------------ version 2.1.2, 2020-09-28 ------------------------------------------------------------------------------ diff --git a/doc/type/field.txt b/doc/type/field.txt index 4ea22878..e43abd74 100644 --- a/doc/type/field.txt +++ b/doc/type/field.txt @@ -27,7 +27,7 @@ Fields are part of the [[file:style triangle]]: * @color@ * @info@ | @name@ [[type:string]] ''required'' Name of the field. -| @description@ [[type:string]] @""@ Description of the field, shown in the status bar when the mouse is over the field. +| @description@ [[type:localized string]] @""@ Description of the field, shown in the status bar when the mouse is over the field. | @icon@ [[type:filename]] Filename of an icon for this field, used for automatically generated [[type:statistics category]]s. | @editable@ [[type:boolean]] @true@ Can values of this field be edited? | @save value@ [[type:boolean]] @true@ Should values of this field be saved to files? Should be disabled for values that are generated by scripts. @@ -38,7 +38,7 @@ Fields are part of the [[file:style triangle]]: | @card list width@ [[type:int]] @100@ Width of the card list column in pixels. | @card list visible@ [[type:boolean]] @false@ Should this field be shown in the card list by default? | @card list allow@ [[type:boolean]] @true@ Should this field be allowed in the card list at all? -| @card list name@ [[type:string]] field name Alternate name to use for the card list, for example an abbreviation. +| @card list name@ [[type:localized string]] field name Alternate name to use for the card list, for example an abbreviation. | @card list alignment@ [[type:alignment]] @left@ Alignment of the card list column. | @sort script@ [[type:script]] Alternate way to sort the card list when using this column to sort the list. diff --git a/doc/type/insert_symbol_menu.txt b/doc/type/insert_symbol_menu.txt index bca4bebf..99dd4532 100644 --- a/doc/type/insert_symbol_menu.txt +++ b/doc/type/insert_symbol_menu.txt @@ -14,18 +14,19 @@ The menu consists of a number of entries, either items, separators or submenus. * @line@, a separating line. * @submenu@, a submenu. | @name@ [[type:string]] ''required'' Name of this menu item, corresponding to the code to insert. +| @label@ [[type:localized string]] name Label to show in the menu. +| @prompt@ [[type:localized string]] Prompt to use for the pop up box with @custom@ type | @items@ [[type:list]] of [[type:insert symbol menu|submenu items]] Items in the submenu, when items are present the @type@ is set to @"submenu"@. -In the user interface the items are shown as @"menu item {name}"@, the [[type:locale]] should be used to give a beter label. - -For custom items the dialog will be titled @"title {name}"@ and have message text @"message {name}"@, again this should be changed in the locale. +For custom items the dialog will be titled with the @label@ and have message text @prompt@. --Examples-- A menu for magic mana symbols (simplified). Containing all types of items. >insert symbol menu: > item: > type: custom -> name: colorless +> name: Generic +> prompt: How much generic mana? > item: > type: line > item: W @@ -34,6 +35,9 @@ A menu for magic mana symbols (simplified). Containing all types of items. > item: R > item: G > item: +> label: Complex +> name: cplx +> item: > type: line > item: > name: hybrid diff --git a/doc/type/locale.txt b/doc/type/locale.txt index e4378330..d943204f 100644 --- a/doc/type/locale.txt +++ b/doc/type/locale.txt @@ -35,12 +35,15 @@ There are usually no other files in the package. | @error@ [[type:map]] of [[type:string]]s Error messages. | @type@ [[type:map]] of [[type:string]]s Types of objects for error messages. | @game@ [[type:map]] of [[type:map]] of [[type:string]]s + Deprecated since MSE 2.1.3, use @localized_...@ instead.
Translations for specific [[type:game]]s.
Field names and field descriptions are looked up in the locale, if they are found the translation is used, otherwise the value from the game file.
Extra keys not present in the English locale can be added here. | @stylesheet@ [[type:map]] of [[type:map]] of [[type:string]]s + Deprecated since MSE 2.1.3, use @localized_...@ instead.
Translations for specific [[type:stylesheet]]s. | @symbol font@ [[type:map]] of [[type:map]] of [[type:string]]s + Deprecated since MSE 2.1.3, use @localized_...@ instead.
Translations for specific [[type:symbol font]]s, in particular the "insert symbol" menu. Some of the items can contain placeholders for other values, for example: diff --git a/doc/type/localized_string.txt b/doc/type/localized_string.txt new file mode 100644 index 00000000..b171a088 --- /dev/null +++ b/doc/type/localized_string.txt @@ -0,0 +1,14 @@ +Localized strings + +A 'localized string' is a [[type:map]] of [[type::string]]s, indexed by locale name. +It is used to translate games and stylesheets to other user interface languages. + +Localized strings can be given with a @localized@ prefix on the property name. +For example, a field has a @description@ which is a [[type::string]], and a @localized_description@ for localized variants. So + +>field: +> name: cost +> description: How much this card costs +> localized description: +> en_US: How much this card costs +> nl_NL: Hoeveel deze kaart kost diff --git a/doc/type/statistics_category.txt b/doc/type/statistics_category.txt index 619f95c5..0e599bfd 100644 --- a/doc/type/statistics_category.txt +++ b/doc/type/statistics_category.txt @@ -12,7 +12,7 @@ Statistics dimensions are automatically generated for all [[type:statistics dime --Properties-- ! Property Type Default Description | @name@ [[type:string]] ''required'' Name of this category. -| @description@ [[type:string]] @""@ A description of the category, currently not used. +| @description@ [[type:localized string]] @""@ A description of the category, currently not used. | @position hint@ [[type:string]] @0@ Hint for ordering category, lower numbers are at the top of the list. | @icon@ [[type:filename]] Filename of an icon for this category, the image should be 21x21 pixels. | @type@ [[type:graph type]] @"bar"@ Type of graph to use. diff --git a/doc/type/statistics_dimension.txt b/doc/type/statistics_dimension.txt index ae6f800c..47ffa00a 100644 --- a/doc/type/statistics_dimension.txt +++ b/doc/type/statistics_dimension.txt @@ -13,7 +13,7 @@ Categories are also automatically generated from dimensions. --Properties-- ! Property Type Default Description | @name@ [[type:string]] ''required'' Name of this dimension, used as an axis label and a label for automatically generated categories. -| @description@ [[type:string]] @""@ A description of the dimension, currently not used. +| @description@ [[type:localized string]] @""@ A description of the dimension, currently not used. | @position hint@ [[type:string]] @0@ Hint for ordering dimensions. | @icon@ [[type:filename]] Filename of an icon for this dimension. | @script@ [[type:script]] ''required'' Script that generates a value for each card in the set. diff --git a/src/data/field.cpp b/src/data/field.cpp index 546e75ac..533a3cbb 100644 --- a/src/data/field.cpp +++ b/src/data/field.cpp @@ -47,8 +47,8 @@ IMPLEMENT_REFLECTION(Field) { REFLECT(type); } REFLECT(name); - REFLECT(caption); - REFLECT(description); + REFLECT_LOCALIZED(caption); + REFLECT_LOCALIZED(description); REFLECT_N("icon", icon_filename); REFLECT(editable); REFLECT(save_value); @@ -59,15 +59,15 @@ IMPLEMENT_REFLECTION(Field) { REFLECT(card_list_width); REFLECT(card_list_visible); REFLECT(card_list_allow); - REFLECT(card_list_name); + REFLECT_LOCALIZED(card_list_name); REFLECT(sort_script); REFLECT_N("card_list_alignment", card_list_align); } void Field::after_reading(Version ver) { name = canonical_name_form(name); - if(caption.empty()) caption = name_to_caption(name); - if(card_list_name.empty()) card_list_name = capitalize(caption); + if(caption.default_.empty()) caption.default_ = name_to_caption(name); + if(card_list_name.default_.empty()) card_list_name.default_ = capitalize(caption.default_); } template <> diff --git a/src/data/field.hpp b/src/data/field.hpp index 191d0f75..bf7c6f9a 100644 --- a/src/data/field.hpp +++ b/src/data/field.hpp @@ -13,6 +13,7 @@ #include #include #include +#include #include