Skip to content

Commit 165fe96

Browse files
beta: Allow to change font family to "system-ui"
1 parent 71422ef commit 165fe96

9 files changed

Lines changed: 147 additions & 30 deletions

File tree

locales/fr_FR/LC_MESSAGES/main.mo

525 Bytes
Binary file not shown.

locales/fr_FR/LC_MESSAGES/main.po

Lines changed: 55 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
msgid ""
22
msgstr ""
33
"Project-Id-Version: Flus\n"
4-
"POT-Creation-Date: 2026-05-14 11:43+0200\n"
5-
"PO-Revision-Date: 2026-05-14 11:43+0200\n"
4+
"POT-Creation-Date: 2026-05-14 11:45+0200\n"
5+
"PO-Revision-Date: 2026-05-14 11:46+0200\n"
66
"Last-Translator: Marien Fressinaud <dev@marienfressinaud.fr>\n"
77
"Language-Team: \n"
88
"Language: fr_FR\n"
@@ -210,11 +210,11 @@ msgstr "L’URL est invalide."
210210
msgid "You already have configured a Mastodon account."
211211
msgstr "Vous avez déjà configuré un compte Mastodon."
212212

213-
#: forms/security/AskResetPassword.php:22 models/User.php:63
213+
#: forms/security/AskResetPassword.php:22 models/User.php:64
214214
msgid "The address email is required."
215215
msgstr "L’adresse courriel est obligatoire."
216216

217-
#: forms/security/AskResetPassword.php:25 models/User.php:66
217+
#: forms/security/AskResetPassword.php:25 models/User.php:67
218218
msgid "The address email is invalid."
219219
msgstr "L’adresse courriel est invalide."
220220

@@ -235,11 +235,11 @@ msgstr "L’une des collections associées n’existe pas."
235235
msgid "Sorry but you cannot do that in the demo 😉"
236236
msgstr "Désolé mais vous ne pouvez pas faire ça dans la démo 😉"
237237

238-
#: forms/traits/Locale.php:19 models/User.php:95
238+
#: forms/traits/Locale.php:19 models/User.php:96
239239
msgid "The locale is required."
240240
msgstr "La langue est obligatoire."
241241

242-
#: forms/traits/Locale.php:22 models/User.php:98
242+
#: forms/traits/Locale.php:22 models/User.php:99
243243
msgid "The locale is invalid."
244244
msgstr "La langue est invalide."
245245

@@ -255,27 +255,35 @@ msgstr ""
255255
msgid "The token has expired or has been invalidated."
256256
msgstr "Le token a expiré ou a été invalidé."
257257

258-
#: forms/users/Preferences.php:53
258+
#: forms/users/Preferences.php:56
259+
msgid "Raleway (default)"
260+
msgstr "Raleway (défaut)"
261+
262+
#: forms/users/Preferences.php:57
263+
msgid "System font"
264+
msgstr "Police système"
265+
266+
#: forms/users/Preferences.php:67
259267
msgid "Small"
260268
msgstr "Petite"
261269

262-
#: forms/users/Preferences.php:54
270+
#: forms/users/Preferences.php:68
263271
msgid "Medium"
264272
msgstr "Moyenne"
265273

266-
#: forms/users/Preferences.php:55
274+
#: forms/users/Preferences.php:69
267275
msgid "Large"
268276
msgstr "Grande"
269277

270-
#: forms/users/Preferences.php:65
278+
#: forms/users/Preferences.php:79
271279
msgid "System"
272280
msgstr "Système"
273281

274-
#: forms/users/Preferences.php:66
282+
#: forms/users/Preferences.php:80
275283
msgid "Light"
276284
msgstr "Clair"
277285

278-
#: forms/users/Preferences.php:67
286+
#: forms/users/Preferences.php:81
279287
msgid "Dark"
280288
msgstr "Sombre"
281289

@@ -363,44 +371,56 @@ msgstr "Le nom est obligatoire."
363371
msgid "The label must be less than {max} characters."
364372
msgstr "Le nom doit faire moins de {max} caractères."
365373

366-
#: models/User.php:69
374+
#: models/User.php:70
367375
msgid "An account already exists with this email address."
368376
msgstr "Un compte existe déjà avec cette adresse courriel."
369377

370-
#: models/User.php:75
378+
#: models/User.php:76
371379
msgid "The username is required."
372380
msgstr "Le nom d’utilisateur·ice est obligatoire."
373381

374-
#: models/User.php:79
382+
#: models/User.php:80
375383
msgid "The username must be less than {max} characters."
376384
msgstr "Le nom d’utilisateur·ice ne doit pas faire plus de {max} caractères."
377385

378-
#: models/User.php:83
386+
#: models/User.php:84
379387
msgid "The username cannot contain the character ‘@’."
380388
msgstr "Le nom d’utilisateur·ice ne doit pas contenir le caractère ‘@’."
381389

382-
#: models/User.php:89
390+
#: models/User.php:90
383391
msgid "The password is required."
384392
msgstr "Le mot de passe est obligatoire."
385393

386-
#: models/User.php:113
394+
#: models/User.php:114
395+
msgid "The font family is required. Please select an option from the list."
396+
msgstr ""
397+
"La police d’écriture est obligatoire. Veuillez sélectionner une valeur "
398+
"depuis la liste."
399+
400+
#: models/User.php:118
401+
msgid "The font family is invalid. Please select an option from the list."
402+
msgstr ""
403+
"La police d’écriture est invalide. Veuillez sélectionner une valeur depuis "
404+
"la liste."
405+
406+
#: models/User.php:124
387407
msgid "The text size is required. Please select an option from the list."
388408
msgstr ""
389409
"La taille de texte est obligatoire. Veuillez sélectionner une valeur depuis "
390410
"la liste."
391411

392-
#: models/User.php:117
412+
#: models/User.php:128
393413
msgid "The text size is invalid. Please select an option from the list."
394414
msgstr ""
395415
"La taille de texte est invalide. Veuillez sélectionner une valeur depuis la "
396416
"liste."
397417

398-
#: models/User.php:123
418+
#: models/User.php:134
399419
msgid "The theme is required. Please select an option from the list."
400420
msgstr ""
401421
"Le thème est obligatoire. Veuillez sélectionner une valeur depuis la liste."
402422

403-
#: models/User.php:127
423+
#: models/User.php:138
404424
msgid "The theme is invalid. Please select an option from the list."
405425
msgstr ""
406426
"Le thème est invalide. Veuillez sélectionner une valeur depuis la liste."
@@ -678,7 +698,8 @@ msgstr "(max. %d caractères)"
678698
#: views/my/account/deletion.html.twig:38 views/my/avatar/edit.html.twig:20
679699
#: views/my/preferences/edit.html.twig:35
680700
#: views/my/preferences/edit.html.twig:67
681-
#: views/my/preferences/edit.html.twig:98 views/my/profile/edit.html.twig:20
701+
#: views/my/preferences/edit.html.twig:98
702+
#: views/my/preferences/edit.html.twig:129 views/my/profile/edit.html.twig:20
682703
#: views/my/profile/edit.html.twig:50
683704
#: views/my/security/confirmation.html.twig:40
684705
#: views/my/security/show.html.twig:31 views/my/security/show.html.twig:59
@@ -753,7 +774,7 @@ msgstr "Modification d'une collection"
753774
#: views/collections/filters/edit.html.twig:96
754775
#: views/collections/groups/edit.html.twig:99 views/groups/edit.html.twig:43
755776
#: views/links/edit.html.twig:80 views/mastodon/show.html.twig:96
756-
#: views/my/preferences/edit.html.twig:173 views/my/profile/edit.html.twig:74
777+
#: views/my/preferences/edit.html.twig:204 views/my/profile/edit.html.twig:74
757778
#: views/my/security/show.html.twig:98 views/notes/edit.html.twig:49
758779
msgid "Save changes"
759780
msgstr "Enregistrer les modifications"
@@ -1400,11 +1421,11 @@ msgstr ""
14001421
"Collectez, organisez, annotez et partagez les liens<br><strong>provenant de "
14011422
"l'ensemble du Web.</strong>"
14021423

1403-
#: views/layouts/base.html.twig:49
1424+
#: views/layouts/base.html.twig:50
14041425
msgid "Skip to main content"
14051426
msgstr "Accéder au contenu principal"
14061427

1407-
#: views/layouts/base.html.twig:66 views/pages/about.html.twig:3
1428+
#: views/layouts/base.html.twig:67 views/pages/about.html.twig:3
14081429
#: views/pages/about.html.twig:11 views/pages/about.html.twig:15
14091430
#: views/support/show.html.twig:124
14101431
#, php-format
@@ -2025,33 +2046,37 @@ msgid "Interface theme"
20252046
msgstr "Thème de l’interface"
20262047

20272048
#: views/my/preferences/edit.html.twig:93
2049+
msgid "Font family"
2050+
msgstr "Police d’écriture"
2051+
2052+
#: views/my/preferences/edit.html.twig:124
20282053
msgid "Text size"
20292054
msgstr "Taille du texte"
20302055

2031-
#: views/my/preferences/edit.html.twig:133
2056+
#: views/my/preferences/edit.html.twig:164
20322057
msgid "Enable compact mode"
20332058
msgstr "Activer le mode compact"
20342059

2035-
#: views/my/preferences/edit.html.twig:137
2060+
#: views/my/preferences/edit.html.twig:168
20362061
msgid ""
20372062
"In compact mode, you see more links at a glance, but you may feel "
20382063
"overwhelmed by the information."
20392064
msgstr ""
20402065
"En mode compact, vous voyez plus de liens en un coup d’œil, mais vous "
20412066
"pourriez vous sentir submergé par la quantité d’informations."
20422067

2043-
#: views/my/preferences/edit.html.twig:150
2068+
#: views/my/preferences/edit.html.twig:181
20442069
#: views/registrations/new.html.twig:148
20452070
msgid "Accept to be contacted by email to help improve the service (optional)."
20462071
msgstr ""
20472072
"Accepter d’être contacté‧e par courriel pour aider à améliorer le service "
20482073
"(facultatif)."
20492074

2050-
#: views/my/preferences/edit.html.twig:164
2075+
#: views/my/preferences/edit.html.twig:195
20512076
msgid "Enable beta features"
20522077
msgstr "Activer les fonctionnalités bêta"
20532078

2054-
#: views/my/preferences/edit.html.twig:168
2079+
#: views/my/preferences/edit.html.twig:199
20552080
msgid ""
20562081
"With beta features you test some features before everyone else, but you "
20572082
"enter a turbulent zone."

src/assets/stylesheets/application.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,7 @@
5858
font-size: 125%;
5959
}
6060
}
61+
62+
:root[data-font-family="system-ui"] body {
63+
font-family: system-ui, sans-serif;
64+
}

src/forms/users/Preferences.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ class Preferences extends BaseForm
1717
{
1818
use traits\Locale;
1919

20+
#[Form\Field]
21+
public string $option_font_family = 'default';
22+
2023
#[Form\Field]
2124
public string $option_text_size = 'medium';
2225

@@ -44,6 +47,17 @@ public function __construct(array $default_values = [], ?models\User $model = nu
4447
parent::__construct($default_values, $model);
4548
}
4649

50+
/**
51+
* @return array<string, string>
52+
*/
53+
public function fontFamilyValues(): array
54+
{
55+
return [
56+
'default' => \Minz\Template\TwigExtension::translate('Raleway (default)'),
57+
'system-ui' => \Minz\Template\TwigExtension::translate('System font'),
58+
];
59+
}
60+
4761
/**
4862
* @return array<string, string>
4963
*/
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
namespace App\migrations;
4+
5+
class Migration202605140001AddOptionFontFamilyToUsers
6+
{
7+
public function migrate(): bool
8+
{
9+
$database = \Minz\Database::get();
10+
11+
$database->exec(<<<'SQL'
12+
ALTER TABLE users
13+
ADD COLUMN option_font_family TEXT NOT NULL DEFAULT 'default';
14+
SQL);
15+
16+
return true;
17+
}
18+
19+
public function rollback(): bool
20+
{
21+
$database = \Minz\Database::get();
22+
23+
$database->exec(<<<'SQL'
24+
ALTER TABLE users
25+
DROP COLUMN option_font_family;
26+
SQL);
27+
28+
return true;
29+
}
30+
}

src/models/User.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class User
2222
use utils\Memoizer;
2323
use Validable;
2424

25+
public const VALID_FONT_FAMILIES = ['default', 'system-ui'];
2526
public const VALID_TEXT_SIZES = ['small', 'medium', 'large'];
2627
public const VALID_COLOR_SCHEMES = ['system', 'light', 'dark'];
2728

@@ -108,6 +109,16 @@ class User
108109
#[Database\Column]
109110
public ?string $autoload_modal;
110111

112+
#[Database\Column]
113+
#[Validable\Presence(
114+
message: new Translatable('The font family is required. Please select an option from the list.'),
115+
)]
116+
#[Validable\Inclusion(
117+
in: self::VALID_FONT_FAMILIES,
118+
message: new Translatable('The font family is invalid. Please select an option from the list.'),
119+
)]
120+
public string $option_font_family = 'default';
121+
111122
#[Database\Column]
112123
#[Validable\Presence(
113124
message: new Translatable('The text size is required. Please select an option from the list.'),

src/schema.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ CREATE TABLE users (
3939
avatar_filename TEXT,
4040
biography TEXT NOT NULL DEFAULT '',
4141
autoload_modal TEXT NOT NULL DEFAULT '',
42+
option_font_family TEXT NOT NULL DEFAULT 'default',
4243
option_text_size TEXT NOT NULL DEFAULT 'medium',
4344
option_color_scheme TEXT NOT NULL DEFAULT 'system',
4445
option_compact_mode BOOLEAN NOT NULL DEFAULT false,

src/views/layouts/base.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
lang="{{ app.locale | locale_to_bcp_47 }}"
44
data-controller="color-scheme"
55
data-color-scheme="{{ app.user and app.user.isBetaEnabled ? app.user.option_color_scheme : 'light' }}"
6+
data-font-family="{{ app.user and app.user.isBetaEnabled ? app.user.option_font_family : 'default' }}"
67
data-text-size="{{ app.user and app.user.isBetaEnabled ? app.user.option_text_size : 'medium' }}"
78
>
89
<head>

src/views/my/preferences/edit.html.twig

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,37 @@
8888
</select>
8989
</div>
9090

91+
<div class="form-group">
92+
<label for="option-font-family">
93+
{{ t('Font family') }}
94+
</label>
95+
96+
{% if form.isInvalid('option_font_family') %}
97+
<p id="option-font-family-error" class="form-group__error">
98+
{{ t('Error:') }}
99+
{{ form.error('option_font_family') }}
100+
</p>
101+
{% endif %}
102+
103+
<select
104+
id="option-font-family"
105+
name="option_font_family"
106+
{% if form.isInvalid('option_font_family') %}
107+
aria-errormessage="option-font-family-error"
108+
aria-invalid="true"
109+
{% endif %}
110+
>
111+
{% for font_family_value, font_family_label in form.fontFamilyValues %}
112+
<option
113+
value="{{ font_family_value }}"
114+
{{ font_family_value === form.option_font_family ? 'selected' : '' }}
115+
>
116+
{{ font_family_label }}
117+
</option>
118+
{% endfor %}
119+
</select>
120+
</div>
121+
91122
<div class="form-group">
92123
<label for="option-text-size">
93124
{{ t('Text size') }}

0 commit comments

Comments
 (0)