Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cards/Fallacies/Argumentum_Fallacies_Face_Web_fr.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cards/Fallacies/Argumentum_Fallacies_Face_fr.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -134,5 +134,49 @@ public void Rules_Localization_Is_Configured_For_All_Target_Languages()
textConv.fieldConversions.Should().Contain(c => c.Language == "ru" && c.destFieldName == "Text_ru");
textConv.fieldConversions.Should().Contain(c => c.Language == "pt" && c.destFieldName == "Text_pt");
}

[Theory]
[InlineData("ru", true)]
[InlineData("en", false)]
[InlineData("pt", false)]
[InlineData("fr", false)]
public void Fallacies_StaticConversions_Inject_LangRu_Body_Class_For_Ru_Only(string destLang, bool expectLangRu)
{
// #316: Cyrillic Fallacies titles run ~15-20% wider than Latin and clip off-card.
// The fix injects a `lang-ru` marker class on the card body wrapper for RU only,
// which engages the inert `.lang-ru .title` rules carried by the templates.
// EN/PT/FR mustache must stay byte-for-byte untouched (no StaticConversion entry).
var loc = GetFallaciesLocalization();
const string template = "<div class=\"body\"><div class=\"title\"><div>NLP</div></div></div>";

var converted = loc.DoStaticConversions(template, destLang);

if (expectLangRu)
{
converted.Should().Contain("<div class=\"body lang-ru\">",
"RU mustache must carry the lang-ru marker class so the .lang-ru CSS rules apply");
}
else
{
converted.Should().Be(template,
$"{destLang} mustache must be left untouched by the RU-only overflow fix");
}
}

[Theory]
[InlineData("Cards/Fallacies/Argumentum_Fallacies_Face_fr.json")]
[InlineData("Cards/Fallacies/Argumentum_Fallacies_Face_Web_fr.json")]
public void Fallacies_OverflowProne_Templates_Carry_LangRu_Title_Rules(string templateRelPath)
{
// The injected lang-ru body class is inert without matching CSS. Guard that the
// large-title templates ship the `.lang-ru .title` font-size reduction plus the
// overflow-wrap break-word escape hatch for extreme single Cyrillic words (#316).
var template = ReadTemplate(templateRelPath);

template.Should().Contain(".lang-ru .title",
"overflow-prone Fallacies templates must carry the .lang-ru title rules (#316)");
template.Should().Contain("overflow-wrap: break-word",
"long single Cyrillic words must be allowed to break to avoid clipping off-card");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ public class AssetConverterConfig
BackFieldConversions = new List<(string sourceFieldName, List<(string Language, string destFieldName)> fieldConversions)>(new []{
("tagline_fr", new List<(string Language, string destFieldName)>(new []{("en", "tagline_en"), ("ru", "tagline_ru"), ("pt", "tagline_pt"), ("es", "tagline_es"), ("ar", "tagline_ar"), ("fa", "tagline_fa"), ("zh", "tagline_zh") }) ),
}),
// RU title overflow fix (#316): Cyrillic titles run ~15-20% wider than Latin and clip off-card
// (e.g. "НЕЙРОЛИНГВИСТИЧЕСКОЕ ПРОГРАММИРОВАНИЕ"). Inject a `lang-ru` marker class on the card
// body wrapper for RU only; the templates carry inert `.lang-ru .title { ... }` rules (font-size
// reduction + overflow-wrap break-word) that engage solely when this class is present.
// FR/EN/PT mustache is untouched (no entry → DoStaticConversions is a no-op for those langs).
StaticConversions = new List<(string sourceText, List<(string Language, string destText)> textConversions)>(new[]{
("<div class=\"body\">", new List<(string Language, string destText)>(new []{("ru", "<div class=\"body lang-ru\">") }) ),
}),
},
new CardSetLocalization()
{
Expand Down
Loading