Skip to content

Commit

Permalink
accessibility: add misc description
Browse files Browse the repository at this point in the history
  • Loading branch information
darakeon committed Jul 30, 2023
1 parent a509d86 commit c715492
Show file tree
Hide file tree
Showing 16 changed files with 150 additions and 12 deletions.
1 change: 1 addition & 0 deletions core/Email/Email/Base.htm
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
border-radius: 10px;
margin: -6px 0 0 0;
"
title="{{MiscImageReading}}"
>
{{Misc}}
</a>
Expand Down
5 changes: 5 additions & 0 deletions core/Email/Format.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ private Format(
replaces.Add("MiscLeg", misc.Leg);
replaces.Add("MiscBackground", misc.Background);
replaces.Add("MiscBorder", misc.Border);

replaces.Add(
"MiscImageReading",
PlainText.GetMiscText(misc, talkable.Language)
);
}

Subject = replaces["Subject"];
Expand Down
4 changes: 4 additions & 0 deletions core/Language/Language.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<ItemGroup>
<None Remove="Language\Email\DeleteCsvData.json" />
<None Remove="Language\Email\general.json" />
<None Remove="Language\Email\misc.json" />
<None Remove="Language\Email\MoveNotification.json" />
<None Remove="Language\Email\NoInteraction.json" />
<None Remove="Language\Email\NotSignedContract.json" />
Expand Down Expand Up @@ -40,6 +41,9 @@
</ItemGroup>

<ItemGroup>
<Content Include="Language\Email\misc.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Language\Email\PersonAsked.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand Down
90 changes: 90 additions & 0 deletions core/Language/Language/Email/misc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{
"en-US": {
"Start": "Image of a character looking like a ball ",

"Color000": "black",
"Color001": "blue",
"Color010": "green",
"Color100": "red",
"Color111": "white",
"Color110": "yellow",
"Color101": "purple",
"Color011": "cyan",

"Stain000": "black without birthmarks",
"Stain001": "black with birthmark on the head at left side",
"Stain010": "black with birthmark at the left leg",
"Stain100": "black with birthmark at the right arm",
"Stain111": "white without birthmarks",
"Stain110": "white with birthmark on the head at left side",
"Stain101": "white with birthmark at the left leg",
"Stain011": "white with birthmark at the right arm",

"Middle": " having ",

"Eyes00": "one eye",
"Eyes01": "two eyes",
"Eyes10": "three eyes forming a triangle",
"Eyes11": "three eyes forming a triangle upside down",

"Arms0": "two arms with rounded hands",
"Arms1": "two arms with forked hands",

"Legs0": "two legs with rounded feet",
"Legs1": "two legs with forked feet",

"Antenna00": "no antenna",
"Antenna01": "two dog ears shaped antennas",
"Antenna10": "a fountain shape antenna",
"Antenna11": "an antenna with two diagonal pins and a little ball in the top",

"Comma": ", ",
"And": " and ",

"": null
},
"pt-BR": {
"Start": "Imagem de personagem que parece uma bolinha ",

"Color000": "preta",
"Color001": "azul",
"Color010": "verde",
"Color100": "vermelha",
"Color111": "branca",
"Color110": "amarela",
"Color101": "roxa",
"Color011": "ciano",

"Stain000": "preta sem marcas de nascença",
"Stain001": "preta com marca de nascença na cabeça à esquerda",
"Stain010": "preta com marca de nascença na perna esquerda",
"Stain100": "preta com marca de nascença no braço direito",
"Stain111": "branca sem marcas de nascença",
"Stain110": "branca com marca de nascença na cabeça à esquerda",
"Stain101": "branca com marca de nascença na perna esquerda",
"Stain011": "branca com marca de nascença no braço direito",

"Middle": " tendo ",

"Eyes00": "um olho",
"Eyes01": "dois olhos",
"Eyes10": "três olhos formando um triângulo",
"Eyes11": "três olhos formando um triângulo de ponta cabeça",

"Arms0": "dois braços com mãos arredondadas",
"Arms1": "dois braços com mãos bifurcadas",

"Legs0": "duas pernas com pés arredondados",
"Legs1": "duas pernas com pés bifurcados",

"Antenna00": "sem antena",
"Antenna01": "com duas antenas parecidas com orelhas de cachorro",
"Antenna10": "com uma antena que parece uma fonte de água",
"Antenna11": "com uma antena com dois pinos diagonais e uma bolinha na ponta",

"Comma": ", ",
"And": " e ",

"": null
}
}
26 changes: 26 additions & 0 deletions core/Language/PlainText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Globalization;
using System.IO;
using System.Linq;
using DFM.Entities;
using DFM.Language.Emails;
using DFM.Language.Entities;
using DFM.Language.Extensions;
Expand Down Expand Up @@ -181,5 +182,30 @@ public static NumberFormatInfo GetNumberFormat(String language)
{
return CultureInfo.GetCultureInfo(language).NumberFormat;
}

public static String GetMiscText(Misc misc, String language)
{
var parts = new[]
{
"Start",
misc.Colors
? $"Color{misc.Color}"
: $"Stain{misc.Color}",
"Comma",
"Middle",
$"Eyes{misc.Eye}",
"Comma",
$"Arms{misc.Arm}",
"Comma",
$"Legs{misc.Leg}",
"And",
$"Antenna{misc.Antenna}"
};

return String.Join(
"",
parts.Select(part => Email["misc", language, part])
);
}
}
}
3 changes: 2 additions & 1 deletion core/Tests/Email/Templates/move-notification.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ <h1 style="[^\"]+">
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ <h1 style="[^\"]+">
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
3 changes: 2 additions & 1 deletion core/Tests/Email/Templates/wipe-notice-no-interaction.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ <h3>{{Date}}</h3>
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ <h3>{{Date}}</h3>
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
3 changes: 2 additions & 1 deletion core/Tests/Email/Templates/wipe-notice-person-asked.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ <h3>{{Date}}</h3>
<a href="{{Url}}/Misc"
target="_blank"
rel="noopener noreferrer"
style="[^\"]+">
style="[^\"]+"
title="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
<div style="[^\"]+">
Expand Down
2 changes: 1 addition & 1 deletion docs/RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This is the list of project releases, past and current. To see tasks that are st
- :ant:: the developer is improving stuff or fixing some sh\*t it did (increases last number)

## <a name="10.1.0.0"></a>10.1.0.0 :whale: <sup>`2`</sup>
- [ ] `230727>......` Check accessibility of email layouts
- [x] `230727>230730` Check accessibility of email layouts
- [x] `230727>230727` Fix alternate text in pig (add pink pig, which is the real description)

## <a name="10.0.1.0"></a>10.0.1.0 :sheep: <sup>`10`</sup>
Expand Down
7 changes: 5 additions & 2 deletions site/MVC/Views/Settings/Misc.cshtml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@model SettingsMiscModel
@using DFM.Language
@model SettingsMiscModel
@{
ViewBag.Title = Context.Translate("MiscSettings");
Layout = "~/Views/Shared/Layouts/_Form.cshtml";
Expand All @@ -15,13 +16,15 @@

ViewBag.SettingsMenuClass = hl["Settings"];
ViewBag.SettingsWipeMenuClass = hl["SettingsWipe"];

var miscImageReading = PlainText.GetMiscText(Model.Misc, Model.Language);
}

@section Styles {
<link rel="stylesheet" type="text/css" href="~/Assets/styles/misc.css?v=@Cfg.Version" />
}

<div class="text-center @hl["Misc"]">
<div class="text-center @hl["Misc"]" title="@miscImageReading">
@await Html.PartialAsync("MiscImage", Model.Misc)
</div>
<hr />
Expand Down

0 comments on commit c715492

Please sign in to comment.