mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Added (partial) support for making cards in French style
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1177 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -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
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 631 B |
Binary file not shown.
|
After Width: | Height: | Size: 545 B |
@@ -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 : "<atom-sep> et </atom-sep>",
|
||||
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 }
|
||||
+42
-31
@@ -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: "<word-list-") +
|
||||
type_over_type +
|
||||
{ "<word-list-type>{input}</word-list-type>" }
|
||||
super_type_filter := {
|
||||
input := remove_tag(tag: "<word-list-")
|
||||
input := type_over_type()
|
||||
tag := "word-list-type" # TODO: localize
|
||||
"<{tag}>{input}</{tag}>"
|
||||
}
|
||||
|
||||
space_to_wltags := replace@(match:"( +|<soft> </soft>)",
|
||||
replace:{"</word-list-{list_type}>{_1}<word-list-{list_type}>"})
|
||||
sub_type_filter :=
|
||||
remove_tag@(tag: "<word-list-") +
|
||||
replace@(match: " </soft>$", replace: "") + # remove trailing soft space
|
||||
remove_tag@(tag: "<soft") +
|
||||
{ list_type := if is_creature(type) then "class"
|
||||
else if is_land(type) then "land"
|
||||
else if is_artifact(type) then "artifact"
|
||||
else if is_enchantment(type) then "enchantment"
|
||||
else if is_spell(type) then "spell"
|
||||
if is_creature(type) or is_tribal(type) then (
|
||||
first := "<word-list-race>{ only_first(input) }</word-list-race>"
|
||||
next := only_next(input)
|
||||
if input == "" then list_type := "" # only edit the race
|
||||
else if next == "" then first := first + "<soft> </soft>"
|
||||
else first := first + " "
|
||||
input := next
|
||||
) else (
|
||||
first := ""
|
||||
)
|
||||
if list_type != "" then (
|
||||
if input != "" then input := input + "<soft> </soft>" # Add a new box at the end
|
||||
first + "<word-list-{list_type}>{ space_to_wltags(input) }</word-list-{list_type}>"
|
||||
) else first + input
|
||||
}
|
||||
break_subtypes := split_text@(match: " +|<atom-sep>[^<]*</atom-sep>", include_empty:false)
|
||||
sub_type_filter := {
|
||||
input := remove_tag(tag: "<word-list-")
|
||||
input := remove_tag(tag: "<soft")
|
||||
lang := language()
|
||||
# What word list to use?
|
||||
list_type_rest := if lang.is_creature(type) then "class"
|
||||
else if lang.is_land(type) then "land"
|
||||
else if lang.is_artifact(type) then "artifact"
|
||||
else if lang.is_enchantment(type) then "enchantment"
|
||||
else if lang.is_spell(type) then "spell"
|
||||
if list_type_rest != "" then (
|
||||
if lang.is_creature(type) or lang.is_tribal(type) then (
|
||||
list_type_first := "race"
|
||||
) else (
|
||||
list_type_first := list_type_rest
|
||||
);
|
||||
# wrap wordlist tag around each part
|
||||
parts := break_subtypes()
|
||||
(for each i:part in parts do
|
||||
if i == 0 then
|
||||
"<word-list-{list_type_first}>{part}</word-list-{list_type_first}>"
|
||||
else
|
||||
lang.subtype_separator + "<word-list-{list_type_rest}>{part}</word-list-{list_type_rest}>"
|
||||
) +
|
||||
(if length(parts) > 0 then
|
||||
# Add a new box at the end
|
||||
"<soft>{lang.subtype_separator}</soft><word-list-{list_type_rest}></word-list-{list_type_rest}>"
|
||||
)
|
||||
) else input # do nothing
|
||||
}
|
||||
|
||||
# all sub types, for word list
|
||||
space_to_comma := replace@(match:" ", replace:",")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user