Skip to content

Commit

Permalink
Added translations (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Feb 24, 2024
1 parent cf46773 commit 214b55c
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 4 deletions.
36 changes: 36 additions & 0 deletions ColorPicker/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions ColorPicker/Properties/Resources.en-US.resx
Original file line number Diff line number Diff line change
Expand Up @@ -717,4 +717,16 @@
<data name="ContrastGrid" xml:space="preserve">
<value>Contrast Grid</value>
</data>
<data name="Score" xml:space="preserve">
<value>Score</value>
</data>
<data name="ScoreAA" xml:space="preserve">
<value>4.5+ (AA)</value>
</data>
<data name="ScoreAAA" xml:space="preserve">
<value>7+ (AAA)</value>
</data>
<data name="ScoreAll" xml:space="preserve">
<value>All</value>
</data>
</root>
12 changes: 12 additions & 0 deletions ColorPicker/Properties/Resources.fr-FR.resx
Original file line number Diff line number Diff line change
Expand Up @@ -721,4 +721,16 @@
<data name="ContrastGrid" xml:space="preserve">
<value>Grille de Contraste</value>
</data>
<data name="Score" xml:space="preserve">
<value>Score</value>
</data>
<data name="ScoreAA" xml:space="preserve">
<value>4.5+ (AA)</value>
</data>
<data name="ScoreAAA" xml:space="preserve">
<value>7+ (AAA)</value>
</data>
<data name="ScoreAll" xml:space="preserve">
<value>Tout</value>
</data>
</root>
12 changes: 12 additions & 0 deletions ColorPicker/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -697,4 +697,16 @@
<data name="ContrastGrid" xml:space="preserve">
<value>Contrast Grid</value>
</data>
<data name="Score" xml:space="preserve">
<value>Score</value>
</data>
<data name="ScoreAA" xml:space="preserve">
<value>4.5+ (AA)</value>
</data>
<data name="ScoreAAA" xml:space="preserve">
<value>7+ (AAA)</value>
</data>
<data name="ScoreAll" xml:space="preserve">
<value>All</value>
</data>
</root>
12 changes: 12 additions & 0 deletions ColorPicker/Properties/Resources.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -725,4 +725,16 @@
<data name="ContrastGrid" xml:space="preserve">
<value>对比网格</value>
</data>
<data name="Score" xml:space="preserve">
<value>得分</value>
</data>
<data name="ScoreAA" xml:space="preserve">
<value>4.5+ (AA)</value>
</data>
<data name="ScoreAAA" xml:space="preserve">
<value>7+ (AAA)</value>
</data>
<data name="ScoreAll" xml:space="preserve">
<value>全部</value>
</data>
</root>
16 changes: 12 additions & 4 deletions ColorPicker/UserControls/ColorGridItem.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,32 @@ namespace ColorPicker.UserControls
/// </summary>
public partial class ColorGridItem : UserControl
{

public RGB ForegroundColor { get; }
public RGB BackgroundColor { get; }

public ColorGridItem(HSL foregroundColor, HSL backgroundColor)
public ColorGridItem(HSL foregroundColor, HSL backgroundColor, double limit)
{
InitializeComponent();
ForegroundColor = ColorHelper.ColorConverter.HslToRgb(foregroundColor);
BackgroundColor = ColorHelper.ColorConverter.HslToRgb(backgroundColor);

InitUI();
InitUI(limit);
}

private void InitUI()
private void InitUI(double limit)
{
double contrast = Global.GetContrastDouble([ForegroundColor.R, ForegroundColor.G, ForegroundColor.B], [BackgroundColor.R, BackgroundColor.G, BackgroundColor.B]);
if (contrast < limit)
{
ColorBorder.Background = Global.GetColorFromResource("Background2");
return;
}

ColorBorder.Background = new SolidColorBrush { Color = Color.FromRgb(BackgroundColor.R, BackgroundColor.G, BackgroundColor.B) };
RatioTxt.Foreground = new SolidColorBrush { Color = Color.FromRgb(ForegroundColor.R, ForegroundColor.G, ForegroundColor.B) };

RatioTxt.Text = Global.GetContrast([ForegroundColor.R, ForegroundColor.G, ForegroundColor.B], [BackgroundColor.R, BackgroundColor.G, BackgroundColor.B]).Item1;
RatioTxt.Text = contrast.ToString();
}
}
}

0 comments on commit 214b55c

Please sign in to comment.