feat: implement client-side localization infrastructure

- Add languageProvider (StateProvider<String>, default 'ru') with
  supportedLanguages map matching backend locale.Supported
- Wire Accept-Language header into AuthInterceptor via languageGetter
  callback; all API requests now carry the current language
- Sync language from user profile preferences into languageProvider
  on every ProfileNotifier load/update
- Add language field to UpdateProfileRequest, serialized as
  preferences.language in PUT /profile
- Profile screen: НАСТРОЙКИ section displays current language;
  edit sheet adds DropdownButtonFormField for language selection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
dbastrikin
2026-02-27 23:34:51 +02:00
parent c0cf1b38ea
commit 0567d90784
7 changed files with 94 additions and 8 deletions

View File

@@ -16,6 +16,7 @@ class UpdateProfileRequest {
final String? gender;
final String? activity;
final String? goal;
final String? language;
const UpdateProfileRequest({
this.name,
@@ -25,6 +26,7 @@ class UpdateProfileRequest {
this.gender,
this.activity,
this.goal,
this.language,
});
Map<String, dynamic> toJson() {
@@ -36,6 +38,7 @@ class UpdateProfileRequest {
if (gender != null) map['gender'] = gender;
if (activity != null) map['activity'] = activity;
if (goal != null) map['goal'] = goal;
if (language != null) map['preferences'] = {'language': language};
return map;
}
}