@autobusal/providers 1.6.4 → 1.6.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/Queries/apiClient.ts +19 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@ All notable changes to `@autobusal/providers` are documented here. This project
|
|
|
4
4
|
adheres to [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [1.6.5] - 2026-07-31
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **`Queries/apiClient.ts` sends `Content-Language`** on every request,
|
|
12
|
+
reflecting the live active i18next language. The API's
|
|
13
|
+
ChangeApiLanguage middleware/Languaged trait expect this to localize
|
|
14
|
+
city/country/article/... names, but the frontend never sent it -
|
|
15
|
+
those names always rendered in the API's own default locale
|
|
16
|
+
regardless of the UI's actual language. Requires obtapi's
|
|
17
|
+
Traits\Languaged fix (falls back safely for the 13 UI languages the
|
|
18
|
+
database has no columns for) and @autobusal/bff 1.2.0 (forwards the
|
|
19
|
+
header upstream in bff mode) to actually take effect end-to-end.
|
|
20
|
+
|
|
7
21
|
## [1.6.4] - 2026-07-30
|
|
8
22
|
|
|
9
23
|
### Added
|
package/Queries/apiClient.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
|
+
import i18next from 'i18next';
|
|
2
3
|
import languages from '@lang/errors';
|
|
3
4
|
import { getLanguage } from '../Setup/languages';
|
|
4
5
|
import { error as systemError } from '@autobusal/utilities';
|
|
@@ -37,6 +38,24 @@ if (!isBffMode) {
|
|
|
37
38
|
});
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
// The API localizes city/country/article/... names off this header
|
|
42
|
+
// (ChangeApiLanguage middleware) - was never sent at all, so every one of
|
|
43
|
+
// those names always rendered in the API's own default locale regardless
|
|
44
|
+
// of the UI's actual language. i18next.language reflects the live active
|
|
45
|
+
// language (kept in sync by Setup/languages.ts on every change), read
|
|
46
|
+
// fresh per request rather than closed over once, so a language switch
|
|
47
|
+
// takes effect on the very next call with no extra wiring anywhere else.
|
|
48
|
+
// In bff mode this also needs public/bff/index.php's api() to forward it
|
|
49
|
+
// upstream (see @autobusal/bff) - both sides had to change, only one of
|
|
50
|
+
// them silently doing nothing would look identical to neither working.
|
|
51
|
+
apiClient.interceptors.request.use(config => {
|
|
52
|
+
if (i18next.language) {
|
|
53
|
+
config.headers['Content-Language'] = i18next.language;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return config;
|
|
57
|
+
});
|
|
58
|
+
|
|
40
59
|
apiClient.interceptors.response.use(response => (
|
|
41
60
|
response
|
|
42
61
|
), async (error) => {
|