feat: expose mobile localization contracts

This commit is contained in:
poyrazavsever
2026-07-19 03:07:54 +03:00
parent c2eeb0ff92
commit 178f285191
14 changed files with 692 additions and 5 deletions
@@ -0,0 +1,24 @@
{
"scenario": "English mobile client receives resolved user locale from /me",
"request": {
"path": "/api/v1/me?locale=en",
"headers": {
"Accept-Language": "en-US,en;q=0.9,tr;q=0.7",
"Cookie": "better-auth.session_token=<redacted>"
}
},
"expected": {
"ok": true,
"data": {
"localization": {
"language": "en",
"portalLocale": null,
"resolvedLocale": "en",
"requestedLocale": "en",
"defaultLocale": "tr",
"source": "query",
"fallbackChain": ["en", "tr"]
}
}
}
}
@@ -0,0 +1,19 @@
{
"scenario": "French is requested before the self-host instance activates it",
"request": {
"path": "/api/v1/me?locale=fr",
"headers": {
"Accept-Language": "fr-FR,fr;q=0.9,en;q=0.8,tr;q=0.7",
"Cookie": "better-auth.session_token=<redacted>"
}
},
"expected": {
"ok": false,
"error": {
"code": "UNSUPPORTED_LOCALE",
"details": {
"requestedLocale": "fr"
}
}
}
}
@@ -0,0 +1,31 @@
{
"scenario": "Turkish mobile client discovers localization support",
"request": {
"path": "/api/v1/meta",
"headers": {
"Accept-Language": "tr-TR,tr;q=0.9,en;q=0.7"
}
},
"expected": {
"ok": true,
"data": {
"capabilities": [
{
"id": "instance.localization",
"version": 1,
"status": "available",
"access": "public"
}
],
"localization": {
"defaultLocale": "tr",
"negotiator": {
"queryParam": "locale",
"header": "Accept-Language",
"unsupportedLocaleCode": "UNSUPPORTED_LOCALE",
"matching": "exact-or-base-language"
}
}
}
}
}