Skip to content

Commit b48fac3

Browse files
committed
Wire up translations
1 parent 0e17121 commit b48fac3

File tree

14 files changed

+784
-72
lines changed

14 files changed

+784
-72
lines changed

CONTRIBUTING.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,25 @@ formatting and linting tools [mentioned above](#code-formatting-and-linting).
192192
You should also follow the install instructions in [`BUILDING.md`](/BUILDING.md)
193193
and execute authentication flows in a browser to ensure that everything
194194
still works as it should.
195+
196+
# Translations
197+
198+
credentialsd-ui is using [gettext-rs](https://github.com/gettext-rs/gettext-rs) to translate user-facing strings.
199+
200+
Please wrap all user-facing messages in `gettext("my string")`-calls and add the files you add them to, to `credentialsd-ui/po/POTFILES`.
201+
202+
If you introduce a new language, also add them to `credentialsd-ui/po/LINGUAS`.
203+
204+
Then `cd` into your build-directory (e.g. `build/`) and run
205+
206+
```
207+
# To update the POT template file, in case new strings have been added in the sources
208+
meson compile credentialds-ui-pot
209+
# and to update the individual language files
210+
meson compile credentialds-ui-update-po
211+
```
212+
to update the template, so it contains all messages to be translated.
213+
214+
Meson should take care of building the translations.
215+
216+
When using the development-profile to build, meson will use the locally built translations.

credentialsd-ui/data/resources/ui/window.ui

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@
4040
<child>
4141
<object class="GtkStackPage">
4242
<property name="name">choose_device</property>
43-
<property name="title">Choose device</property>
43+
<property name="title" translatable="yes">Choose device</property>
4444
<property name="child">
4545
<object class="GtkBox">
4646
<property name="orientation">vertical</property>
4747
<child>
4848
<object class="GtkLabel">
49-
<property name="label">Devices</property>
49+
<property name="label" translatable="yes">Devices</property>
5050
</object>
5151
</child>
5252
<child>
@@ -69,7 +69,7 @@
6969
<child>
7070
<object class="GtkStackPage">
7171
<property name="name">usb</property>
72-
<property name="title">Plug in security key</property>
72+
<property name="title" translatable="yes">Plug in security key</property>
7373
<property name="child">
7474
<object class="GtkBox">
7575
<property name="orientation">vertical</property>
@@ -110,7 +110,7 @@
110110
<child>
111111
<object class="GtkStackPage">
112112
<property name="name">hybrid_qr</property>
113-
<property name="title">Scan the QR code to connect your device</property>
113+
<property name="title" translatable="yes">Scan the QR code to connect your device</property>
114114
<property name="child">
115115
<object class="GtkBox">
116116
<property name="orientation">vertical</property>
@@ -155,13 +155,13 @@
155155
<child>
156156
<object class="GtkStackPage">
157157
<property name="name">choose_credential</property>
158-
<property name="title">Choose credential</property>
158+
<property name="title" translatable="yes">Choose credential</property>
159159
<property name="child">
160160
<object class="GtkBox">
161161
<property name="orientation">vertical</property>
162162
<child>
163163
<object class="GtkLabel">
164-
<property name="label">Choose credential</property>
164+
<property name="label" translatable="yes">Choose credential</property>
165165
</object>
166166
</child>
167167
<child>
@@ -184,13 +184,13 @@
184184
<child>
185185
<object class="GtkStackPage">
186186
<property name="name">completed</property>
187-
<property name="title">Complete</property>
187+
<property name="title" translatable="yes">Complete</property>
188188
<property name="child">
189189
<object class="GtkBox">
190190
<property name="orientation">vertical</property>
191191
<child>
192192
<object class="GtkLabel">
193-
<property name="label">Done!</property>
193+
<property name="label" translatable="yes">Done!</property>
194194
</object>
195195
</child>
196196
</object>
@@ -201,7 +201,7 @@
201201
<child>
202202
<object class="GtkStackPage">
203203
<property name="name">failed</property>
204-
<property name="title">Something went wrong.</property>
204+
<property name="title" translatable="yes">Something went wrong.</property>
205205
<property name="child">
206206
<object class="GtkBox">
207207
<property name="orientation">vertical</property>
@@ -214,7 +214,7 @@
214214
</lookup>
215215
</lookup>
216216
</binding>
217-
<property name="label">Something went wrong while retrieving a credential. Please try again later or use a different authenticator.</property>
217+
<property name="label" translatable="yes">Something went wrong while retrieving a credential. Please try again later or use a different authenticator.</property>
218218
</object>
219219
</child>
220220
</object>

credentialsd-ui/meson.build

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ localedir = prefix / get_option('localedir')
3131
datadir = prefix / get_option('datadir')
3232
pkgdatadir = datadir / gui_executable_name
3333
iconsdir = datadir / 'icons'
34-
podir = meson.project_source_root() / meson.current_source_dir() / 'po'
35-
gettext_package = gui_executable_name
3634

3735
if get_option('profile') == 'development'
3836
profile = 'Devel'
@@ -71,6 +69,10 @@ if get_option('cargo_offline') == true
7169
cargo_options += ['--offline']
7270
endif
7371

72+
# Localization setup
73+
podir = meson.project_source_root() / meson.current_source_dir() / 'po'
74+
gettext_package = gui_executable_name
75+
7476
subdir('data')
7577
subdir('po')
7678
subdir('src')
@@ -79,4 +81,4 @@ gnome.post_install(
7981
gtk_update_icon_cache: true,
8082
glib_compile_schemas: true,
8183
update_desktop_database: true,
82-
)
84+
)

credentialsd-ui/po/LINGUAS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
en_US
2+
de_DE

credentialsd-ui/po/POTFILES.in

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
data/xyz.iinuwa.CredentialManager.desktop.in.in
2-
data/xyz.iinuwa.CredentialManager.gschema.xml.in
3-
data/xyz.iinuwa.CredentialManager.metainfo.xml.in.in
1+
data/xyz.iinuwa.credentialsd.CredentialsUi.desktop.in.in
2+
data/xyz.iinuwa.credentialsd.CredentialsUi.gschema.xml.in
3+
data/xyz.iinuwa.credentialsd.CredentialsUi.metainfo.xml.in.in
44
data/resources/ui/shortcuts.ui
55
data/resources/ui/window.ui
6-
src/application.rs
6+
src/gui/view_model/gtk/mod.rs
7+
src/gui/view_model/gtk/device.rs
8+
src/gui/view_model/mod.rs
Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
msgid ""
2+
msgstr ""
3+
"POT-Creation-Date: 2025-10-13 11:55+0200\n"
4+
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
5+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
6+
"Language: \n"
7+
"MIME-Version: 1.0\n"
8+
"Content-Type: text/plain; charset=UTF-8\n"
9+
"Content-Transfer-Encoding: 8bit\n"
10+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
11+
12+
#. Insert your license of choice here
13+
#. <project_license>LGPL-3.0-only</project_license>
14+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.desktop.in.in:2
15+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.metainfo.xml.in.in:8
16+
#: src/gui/view_model/gtk/mod.rs:372
17+
msgid "Credential Manager"
18+
msgstr ""
19+
20+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.desktop.in.in:3
21+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.metainfo.xml.in.in:9
22+
msgid "Write a GTK + Rust application"
23+
msgstr ""
24+
25+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.desktop.in.in:9
26+
msgid "Gnome;GTK;"
27+
msgstr ""
28+
29+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.gschema.xml.in:6
30+
msgid "Window width"
31+
msgstr ""
32+
33+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.gschema.xml.in:10
34+
msgid "Window height"
35+
msgstr ""
36+
37+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.gschema.xml.in:14
38+
msgid "Window maximized state"
39+
msgstr ""
40+
41+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.metainfo.xml.in.in:11
42+
msgid ""
43+
"A boilerplate template for GTK + Rust. It uses Meson as a build system and "
44+
"has flatpak support by default."
45+
msgstr ""
46+
47+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.metainfo.xml.in.in:16
48+
msgid "Registering a credential"
49+
msgstr ""
50+
51+
#. developer_name tag deprecated with Appstream 1.0
52+
#: data/xyz.iinuwa.credentialsd.CredentialsUi.metainfo.xml.in.in:34
53+
msgid "Isaiah Inuwa"
54+
msgstr ""
55+
56+
#: data/resources/ui/shortcuts.ui:11
57+
msgctxt "shortcut window"
58+
msgid "General"
59+
msgstr ""
60+
61+
#: data/resources/ui/shortcuts.ui:14
62+
msgctxt "shortcut window"
63+
msgid "Show Shortcuts"
64+
msgstr ""
65+
66+
#: data/resources/ui/shortcuts.ui:20
67+
msgctxt "shortcut window"
68+
msgid "Quit"
69+
msgstr ""
70+
71+
#: data/resources/ui/window.ui:6
72+
msgid "_Preferences"
73+
msgstr ""
74+
75+
#: data/resources/ui/window.ui:10
76+
msgid "_Keyboard Shortcuts"
77+
msgstr ""
78+
79+
#: data/resources/ui/window.ui:43
80+
msgid "Choose device"
81+
msgstr ""
82+
83+
#: data/resources/ui/window.ui:49
84+
msgid "Devices"
85+
msgstr ""
86+
87+
#: data/resources/ui/window.ui:72
88+
msgid "Plug in security key"
89+
msgstr ""
90+
91+
#: data/resources/ui/window.ui:113
92+
msgid "Scan the QR code to connect your device"
93+
msgstr ""
94+
95+
#: data/resources/ui/window.ui:158 data/resources/ui/window.ui:164
96+
msgid "Choose credential"
97+
msgstr ""
98+
99+
#: data/resources/ui/window.ui:187
100+
msgid "Complete"
101+
msgstr ""
102+
103+
#: data/resources/ui/window.ui:193
104+
msgid "Done!"
105+
msgstr ""
106+
107+
#: data/resources/ui/window.ui:204
108+
msgid "Something went wrong."
109+
msgstr ""
110+
111+
#: data/resources/ui/window.ui:217 src/gui/view_model/mod.rs:233
112+
msgid ""
113+
"Something went wrong while retrieving a credential. Please try again later "
114+
"or use a different authenticator."
115+
msgstr ""
116+
117+
#: src/gui/view_model/gtk/mod.rs:137
118+
msgid "Enter your PIN."
119+
msgstr ""
120+
121+
#: src/gui/view_model/gtk/mod.rs:140
122+
msgid "One attempt remaining."
123+
msgid_plural "%d attempts remaining."
124+
msgstr[0] ""
125+
msgstr[1] ""
126+
127+
#: src/gui/view_model/gtk/mod.rs:154
128+
msgid "Touch your device again. One attempt remaining."
129+
msgid_plural "Touch your device again. %d attempts remaining."
130+
msgstr[0] ""
131+
msgstr[1] ""
132+
133+
#: src/gui/view_model/gtk/mod.rs:160
134+
msgid "Touch your device."
135+
msgstr ""
136+
137+
#: src/gui/view_model/gtk/mod.rs:165
138+
msgid "Touch your device"
139+
msgstr ""
140+
141+
#: src/gui/view_model/gtk/mod.rs:168
142+
msgid "Scan the QR code with your device to begin authentication."
143+
msgstr ""
144+
145+
#: src/gui/view_model/gtk/mod.rs:178
146+
msgid ""
147+
"Connecting to your device. Make sure both devices are near each other and "
148+
"have Bluetooth enabled."
149+
msgstr ""
150+
151+
#: src/gui/view_model/gtk/mod.rs:186
152+
msgid "Device connected. Follow the instructions on your device"
153+
msgstr ""
154+
155+
#: src/gui/view_model/gtk/mod.rs:312
156+
msgid "Insert your security key."
157+
msgstr ""
158+
159+
#: src/gui/view_model/gtk/mod.rs:328
160+
msgid "Multiple devices found. Please select with which to proceed."
161+
msgstr ""
162+
163+
#: src/gui/view_model/gtk/device.rs:57
164+
msgid "A Bluetooth device"
165+
msgstr ""
166+
167+
#: src/gui/view_model/gtk/device.rs:58
168+
msgid "This device"
169+
msgstr ""
170+
171+
#: src/gui/view_model/gtk/device.rs:59
172+
msgid "A mobile device"
173+
msgstr ""
174+
175+
#: src/gui/view_model/gtk/device.rs:60
176+
msgid "Linked Device"
177+
msgstr ""
178+
179+
#: src/gui/view_model/gtk/device.rs:61
180+
msgid "An NFC device"
181+
msgstr ""
182+
183+
#: src/gui/view_model/gtk/device.rs:62
184+
msgid "A security key"
185+
msgstr ""
186+
187+
#: src/gui/view_model/mod.rs:65
188+
msgid "Create new credential"
189+
msgstr ""
190+
191+
#: src/gui/view_model/mod.rs:66
192+
msgid "Use a credential"
193+
msgstr ""
194+
195+
#: src/gui/view_model/mod.rs:173
196+
msgid "Failed to select credential from device."
197+
msgstr ""
198+
199+
#: src/gui/view_model/mod.rs:227
200+
msgid "No matching credentials found on this authenticator."
201+
msgstr ""
202+
203+
#: src/gui/view_model/mod.rs:230
204+
msgid ""
205+
"No more PIN attempts allowed. Try removing your device and plugging it back "
206+
"in."
207+
msgstr ""
208+
209+
#: src/gui/view_model/mod.rs:236
210+
msgid "This credential is already registered on this authenticator."
211+
msgstr ""
212+
213+
#: src/gui/view_model/mod.rs:284
214+
msgid "Something went wrong. Try again later or use a different authenticator."
215+
msgstr ""

0 commit comments

Comments
 (0)