Skip to content

Commit 90145dd

Browse files
committed
i18n: i18n tailscale frontend features
1 parent 9c0fe75 commit 90145dd

5 files changed

Lines changed: 43 additions & 17 deletions

File tree

frontend/src/lib/i18n/locales/en-US.json

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,17 @@
8080
"profileScopeDescription": "Allows the app to access your profile information.",
8181
"groupsScopeName": "Groups",
8282
"groupsScopeDescription": "Allows the app to access your group information.",
83-
"backToLoginButton": "Back to login"
83+
"backToLoginButton": "Back to login",
84+
"phoneScopeName": "Phone",
85+
"phoneScopeDescription": "Allows the app to access your phone number.",
86+
"addressScopeName": "Address",
87+
"addressScopeDescription": "Allows the app to access your address.",
88+
"loginTailscaleTitle": "Continue with Tailscale",
89+
"loginTailscaleDescription": "We detected that you are accessing Tinyauth from an authorized Tailscale device. Would you like to continue with your Tailscale connection?",
90+
"loginTailscaleDeviceName": "Device name:",
91+
"loginTailscaleSubmit": "Continue with Tailscale",
92+
"loginTailscaleOtherMethod": "Login with another method",
93+
"loginTailscaleSuccess": "Successfully authenticated with Tailscale.",
94+
"loginTailscaleFail": "Failed to authenticate with Tailscale. Please try again or use another login method.",
95+
"logoutTailscaleSubtitle": "You are currently logged in with Tailscale on your device <code>{{deviceName}}</code>. Click the button below to logout."
8496
}

frontend/src/lib/i18n/locales/en.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,13 @@
8484
"phoneScopeName": "Phone",
8585
"phoneScopeDescription": "Allows the app to access your phone number.",
8686
"addressScopeName": "Address",
87-
"addressScopeDescription": "Allows the app to access your address."
87+
"addressScopeDescription": "Allows the app to access your address.",
88+
"loginTailscaleTitle": "Continue with Tailscale",
89+
"loginTailscaleDescription": "We detected that you are accessing Tinyauth from an authorized Tailscale device. Would you like to continue with your Tailscale connection?",
90+
"loginTailscaleDeviceName": "Device name:",
91+
"loginTailscaleSubmit": "Continue with Tailscale",
92+
"loginTailscaleOtherMethod": "Login with another method",
93+
"loginTailscaleSuccess": "Successfully authenticated with Tailscale.",
94+
"loginTailscaleFail": "Failed to authenticate with Tailscale. Please try again or use another login method.",
95+
"logoutTailscaleSubtitle": "You are currently logged in with Tailscale on your device <code>{{deviceName}}</code>. Click the button below to logout."
8896
}

frontend/src/pages/login-page.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ export const LoginPage = () => {
158158
mutationFn: () => axios.post("/api/user/tailscale"),
159159
mutationKey: ["tailscale"],
160160
onSuccess: () => {
161-
toast.success("Logged in", {
162-
description: t("Tailscale session confirmed"),
161+
toast.success(t("loginSuccessTitle"), {
162+
description: t("loginTailscaleSuccess"),
163163
});
164164

165165
redirectTimer.current = window.setTimeout(() => {
@@ -173,8 +173,8 @@ export const LoginPage = () => {
173173
}, 500);
174174
},
175175
onError: () => {
176-
toast.error("Failed to login", {
177-
description: "Failed to authenticate with Tailscale.",
176+
toast.error(t("loginFailTitle"), {
177+
description: t("loginTailscaleFail"),
178178
});
179179
},
180180
});
@@ -266,17 +266,15 @@ export const LoginPage = () => {
266266
<CardHeader className="gap-3">
267267
<TailscaleIcon className="mx-auto h-8 w-8" />
268268
<CardTitle className="text-center text-xl">
269-
Tinyauth · Tailscale
269+
{t("loginTailscaleTitle")}
270270
</CardTitle>
271271
</CardHeader>
272272
<CardContent className="flex flex-col gap-4">
273273
<div className="text-muted-foreground text-sm">
274-
We detected that you are accessing Tinyauth from an authorized
275-
Tailscale device. Would you like to continue with your Tailscale
276-
credentials?
274+
{t("loginTailscaleDescription")}
277275
</div>
278276
<div className="text-muted-foreground text-sm">
279-
Machine Name: <code>{tailscale.nodeName}</code>
277+
{t("loginTailscaleDeviceName")} <code>{tailscale.nodeName}</code>
280278
</div>
281279
</CardContent>
282280
<CardFooter className="flex flex-col items-stretch gap-3">
@@ -285,15 +283,15 @@ export const LoginPage = () => {
285283
onClick={() => tailscaleMutate()}
286284
loading={tailscaleIsPending}
287285
>
288-
Continue with Tailscale
286+
{t("loginTailscaleSubmit")}
289287
</Button>
290288
<Button
291289
className="w-full"
292290
variant="outline"
293291
onClick={() => setUseTailscale(false)}
294292
disabled={tailscaleIsPending}
295293
>
296-
Use other login method
294+
{t("loginTailscaleOtherMethod")}
297295
</Button>
298296
</CardFooter>
299297
</Card>

frontend/src/pages/logout-page.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,17 @@ export const LogoutPage = () => {
7575
if (auth.providerId === "tailscale") {
7676
return (
7777
<LogoutLayout logoutMutation={logoutMutation}>
78-
You are currently logged in with the Tailscale integration identified by
79-
the <code>{tailscale.nodeName}</code> node. Click the button below to
80-
log out.
78+
<Trans
79+
i18nKey="logoutTailscaleSubtitle"
80+
t={t}
81+
components={{
82+
code: <code />,
83+
}}
84+
values={{
85+
deviceName: tailscale.nodeName,
86+
}}
87+
shouldUnescape={true}
88+
/>
8189
</LogoutLayout>
8290
);
8391
}

internal/bootstrap/app_bootstrap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ func (app *BootstrapApp) serveUnix() error {
396396
}
397397

398398
func (app *BootstrapApp) serveTailscale() error {
399-
app.log.App.Info().Msgf("Starting Tailscale server on %s", app.services.tailscaleService.GetHostname())
399+
app.log.App.Info().Msgf("Starting Tailscale server on %s", fmt.Sprintf("https://%s", app.services.tailscaleService.GetHostname()))
400400

401401
listener, err := app.services.tailscaleService.CreateListener()
402402

0 commit comments

Comments
 (0)