diff --git a/data/magic.mse-game/card_fields b/data/magic.mse-game/card_fields index c12c2dfe..ab5eff46 100644 --- a/data/magic.mse-game/card_fields +++ b/data/magic.mse-game/card_fields @@ -169,7 +169,7 @@ card field: # Either just supertype, or subtype - supertype combined_editor( field1: card.super_type, - separator: " — ", + separator: language().type_separator, field2: card.sub_type, soft_before_empty: true, hide_when_empty: true @@ -275,7 +275,7 @@ card field: script: combined_editor( field1: card.power, - separator: "/", + separator: language().pt_separator, field2: card.toughness, soft_before_empty: true, hide_when_empty: true @@ -424,7 +424,7 @@ card field: script: combined_editor( field1: card.super_type_2, - separator: " — ", + separator: language().type_separator, field2: card.sub_type_2, soft_before_empty: true, hide_when_empty: true @@ -495,7 +495,7 @@ card field: script: combined_editor( field1: card.power_2, - separator: "/", + separator: language().pt_separator, field2: card.toughness_2, soft_before_empty: true, hide_when_empty: true diff --git a/data/magic.mse-game/icons/language-en.png b/data/magic.mse-game/icons/language-en.png new file mode 100644 index 00000000..196db587 Binary files /dev/null and b/data/magic.mse-game/icons/language-en.png differ diff --git a/data/magic.mse-game/icons/language-fr.png b/data/magic.mse-game/icons/language-fr.png new file mode 100644 index 00000000..8332c4ec Binary files /dev/null and b/data/magic.mse-game/icons/language-fr.png differ diff --git a/data/magic.mse-game/language b/data/magic.mse-game/language new file mode 100644 index 00000000..8b9432e5 --- /dev/null +++ b/data/magic.mse-game/language @@ -0,0 +1,33 @@ + + +# Language specific strings +languages := [ + English: [ + code : "en", + pt_separator : "/", + type_separator : " — ", + subtype_separator : " ", + is_creature : match@(match: "(?i)Creature") + is_tribal : match@(match: "(?i)Tribal") + is_artifact : match@(match: "(?i)Artifact") + is_land : match@(match: "(?i)Land") + is_enchantment : match@(match: "(?i)Enchantment") + is_spell : match@(match: "(?i)Instant|Sorcery") + ], + + Français: [ + code : "fr", + pt_separator : "/", + type_separator : " : " + subtype_separator : " et ", + is_creature : match@(match: "(?i)Creature|Créature") + is_tribal : match@(match: "(?i)Tribal") + is_artifact : match@(match: "(?i)Artifact") + is_land : match@(match: "(?i)Land") + is_enchantment : match@(match: "(?i)Enchantment") + is_spell : match@(match: "(?i)Instant|Sorcery") + ] +] + +# The selected language +language := { languages[set.card_language] or else language.English } diff --git a/data/magic.mse-game/script b/data/magic.mse-game/script index ef3e47c3..fe3ef639 100644 --- a/data/magic.mse-game/script +++ b/data/magic.mse-game/script @@ -1,4 +1,8 @@  +############################################################## Localization + +include file: language + ############################################################## Sorting mana symbols # correctly sort a mana symbol (no guild mana) @@ -413,39 +417,46 @@ flavor_text_filter := # Move the cursor past the separator in the p/t and type boxes type_over_pt := replace@(match:"/$", replace:"") -type_over_type := replace@(match:" ?-$", replace:"") +type_over_type := replace@(match:" ?[-:]$", replace:"") -super_type_filter := - remove_tag@(tag: "{input}" } +super_type_filter := { + input := remove_tag(tag: "{input}" +} -space_to_wltags := replace@(match:"( +| )", - replace:{"{_1}"}) -sub_type_filter := - remove_tag@(tag: "$", replace: "") + # remove trailing soft space - remove_tag@(tag: " " - else first := first + " " - input := next - ) else ( - first := "" - ) - if list_type != "" then ( - if input != "" then input := input + " " # Add a new box at the end - first + "{ space_to_wltags(input) }" - ) else first + input - } +break_subtypes := split_text@(match: " +|[^<]*", include_empty:false) +sub_type_filter := { + input := remove_tag(tag: "{part}" + else + lang.subtype_separator + "{part}" + ) + + (if length(parts) > 0 then + # Add a new box at the end + "{lang.subtype_separator}" + ) + ) else input # do nothing +} # all sub types, for word list space_to_comma := replace@(match:" ", replace:",") diff --git a/data/magic.mse-game/set_fields b/data/magic.mse-game/set_fields index f022a223..eb5b2d51 100644 --- a/data/magic.mse-game/set_fields +++ b/data/magic.mse-game/set_fields @@ -70,6 +70,13 @@ set field: choice: after other cards choice: separate numbering initial: after other cards +set field: + type: choice + name: card language + description: Language for the cards + choice: English + choice: Français + initial: English set field: type: boolean name: mark errors @@ -144,3 +151,8 @@ default set style: choice images: yes: script: built_in_image("bool_yes") no: script: built_in_image("bool_no") + card language: + render style: both + choice images: + English: /magic.mse-game/icons/language-en.png + Français: /magic.mse-game/icons/language-fr.png