api: return localized fields only in the requested ?lang=
appresult.Localize, the first admin middleware, rewrites JSON responses so
every {en, ru, tm} object becomes the plain string for ?lang= (tm, ru, en;
default tm), falling back tm -> ru -> en when that translation is empty.
?lang=all keeps the full objects for edit forms; other values are 400.
Key order and number precision are preserved; non-JSON responses and
/swagger are untouched.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11281,7 +11281,7 @@ var SwaggerInfo = &swag.Spec{
|
||||
BasePath: "/api/admin",
|
||||
Schemes: []string{},
|
||||
Title: "Service APIs",
|
||||
Description: "Online payment system admin API.",
|
||||
Description: "Online payment system admin API. Localized fields ({en, ru, tm} objects) come back as a plain string in the language of the `lang` query parameter: tm, ru or en (default tm), falling back to tm, ru, en when that translation is empty. lang=all returns the full {en, ru, tm} objects (for edit forms); any other value is 400.",
|
||||
InfoInstanceName: "swagger",
|
||||
SwaggerTemplate: docTemplate,
|
||||
LeftDelim: "{{",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"swagger": "2.0",
|
||||
"info": {
|
||||
"description": "Online payment system admin API.",
|
||||
"description": "Online payment system admin API. Localized fields ({en, ru, tm} objects) come back as a plain string in the language of the `lang` query parameter: tm, ru or en (default tm), falling back to tm, ru, en when that translation is empty. lang=all returns the full {en, ru, tm} objects (for edit forms); any other value is 400.",
|
||||
"title": "Service APIs",
|
||||
"contact": {},
|
||||
"version": "1.0"
|
||||
|
||||
@@ -2168,7 +2168,11 @@ definitions:
|
||||
host: localhost:5005
|
||||
info:
|
||||
contact: {}
|
||||
description: Online payment system admin API.
|
||||
description: 'Online payment system admin API. Localized fields ({en, ru, tm} objects)
|
||||
come back as a plain string in the language of the `lang` query parameter: tm,
|
||||
ru or en (default tm), falling back to tm, ru, en when that translation is empty.
|
||||
lang=all returns the full {en, ru, tm} objects (for edit forms); any other value
|
||||
is 400.'
|
||||
title: Service APIs
|
||||
version: "1.0"
|
||||
paths:
|
||||
|
||||
Reference in New Issue
Block a user