Skip to content
This repository was archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
🎨 优化了APP的I18n功能,以兼容未来赛季更新新内容而无法正确现实的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
dzxrly committed Feb 12, 2024
1 parent 9e52698 commit dbdad8b
Show file tree
Hide file tree
Showing 12 changed files with 104 additions and 68 deletions.
13 changes: 9 additions & 4 deletions lib/components/classes_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:battlefield_2042_state/components/basic/player_detail_info_list.dart';
import 'package:battlefield_2042_state/model/player_info_ensemble.dart';
import 'package:battlefield_2042_state/model/player_info_model.dart';
import 'package:battlefield_2042_state/utils/lang.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -47,8 +48,10 @@ class ClassesList extends StatelessWidget {
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
AppLocalizations.of(context)!
.characterName(classes.characterName),
Translator.appLocalizationsTranslate(
AppLocalizations.of(context)!
.characterName(classes.characterName),
classes.characterName),
style: Theme.of(context).textTheme.titleLarge),
),
const Padding(padding: EdgeInsets.only(left: 8)),
Expand Down Expand Up @@ -146,8 +149,10 @@ class ClassesListItem extends StatelessWidget {
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text(
AppLocalizations.of(context)!
.characterName(classes.characterName),
Translator.appLocalizationsTranslate(
AppLocalizations.of(context)!
.characterName(classes.characterName),
classes.characterName),
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.bodyMedium),
)),
Expand Down
12 changes: 9 additions & 3 deletions lib/components/gamemode_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:battlefield_2042_state/components/basic/player_detail_info_list.dart';
import 'package:battlefield_2042_state/model/player_info_ensemble.dart';
import 'package:battlefield_2042_state/model/player_info_model.dart';
import 'package:battlefield_2042_state/utils/lang.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -83,8 +84,10 @@ class GameModeList extends StatelessWidget {
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
AppLocalizations.of(context)!
.gameModeName(gamemode.modeName),
Translator.appLocalizationsTranslate(
AppLocalizations.of(context)!
.gameModeName(gamemode.modeName),
gamemode.modeName),
style: Theme.of(context).textTheme.titleLarge),
),
const Padding(padding: EdgeInsets.only(left: 8)),
Expand Down Expand Up @@ -185,7 +188,10 @@ class GameModeListItem extends StatelessWidget {
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text(
AppLocalizations.of(context)!.gameModeName(gamemode.modeName),
Translator.appLocalizationsTranslate(
AppLocalizations.of(context)!
.gameModeName(gamemode.modeName),
gamemode.modeName),
style: Theme.of(context).textTheme.bodyMedium),
)),
Expanded(
Expand Down
11 changes: 7 additions & 4 deletions lib/components/key_info_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,13 @@ class _KeyInfoViewState extends State<KeyInfoView> {
const Padding(
padding: EdgeInsets.only(left: 2)),
Text(
AppLocalizations.of(context)!
.bfbanStatus(
Translator.bfbanStatusTranslate(
bfbanStatus)),
Translator.appLocalizationsTranslate(
AppLocalizations.of(context)!
.bfbanStatus(Translator
.bfbanStatusTranslate(
bfbanStatus)),
Translator.bfbanStatusTranslate(
bfbanStatus)),
softWrap: true,
textAlign: TextAlign.center,
style: TextStyle(
Expand Down
11 changes: 8 additions & 3 deletions lib/components/map_list.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:battlefield_2042_state/components/basic/player_detail_info_list.dart';
import 'package:battlefield_2042_state/model/player_info_ensemble.dart';
import 'package:battlefield_2042_state/model/player_info_model.dart';
import 'package:battlefield_2042_state/utils/lang.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -47,8 +48,10 @@ class MapList extends StatelessWidget {
FittedBox(
fit: BoxFit.scaleDown,
child: Text(
AppLocalizations.of(context)!
.mapName(mapElement.mapName),
Translator.appLocalizationsTranslate(
AppLocalizations.of(context)!
.mapName(mapElement.mapName),
mapElement.mapName),
style: Theme.of(context).textTheme.titleLarge),
),
const Padding(padding: EdgeInsets.only(left: 8)),
Expand Down Expand Up @@ -139,7 +142,9 @@ class MapListItem extends StatelessWidget {
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Text(
AppLocalizations.of(context)!.mapName(mapElement.mapName),
Translator.appLocalizationsTranslate(
AppLocalizations.of(context)!.mapName(mapElement.mapName),
mapElement.mapName),
textAlign: TextAlign.left,
style: Theme.of(context).textTheme.bodyMedium),
)),
Expand Down
22 changes: 11 additions & 11 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"@searchResultsTitle": {
"description": "Title of the search results"
},
"requestErrorTip": "{requestError, select, notPlay2042{The player may not played BF2042} notFound{Player not found} serverError{Data API server error, please try again later} networkError{Network error, please check your network} unknownError{Unknown error, please try again later} timeoutError{Request timeout, please try again later} rejectedError{The server rejected the request, please try again later} privateLimitError{Player state is protected by private setting} other{requestError}}",
"requestErrorTip": "{requestError, select, notPlay2042{The player may not played BF2042} notFound{Player not found} serverError{Data API server error, please try again later} networkError{Network error, please check your network} unknownError{Unknown error, please try again later} timeoutError{Request timeout, please try again later} rejectedError{The server rejected the request, please try again later} privateLimitError{Player state is protected by private setting} other{default}}",
"@requestErrorTip": {
"description": "Tip for the request error",
"placeholders": {
Expand All @@ -69,7 +69,7 @@
}
}
},
"dataAPIDescription": "{dataAPIDesc, select, gametools{[Recommend] Provided by gametools.network. You can check the players with hidden records and support UID query, so you don''t need to worry about changing your name. However, its server performance is average and it may have problems with jerking.} bftracker{[Not open temporarily] Unofficial requests are made to battlefieldtracker.com, whose servers are more stable, but the requests may be blocked. In addition, the data is not as detailed as that of gametools and can only be accessed by nicknames, not by players with hidden scores, which are also affected by name changes.} other{dataAPIDesc}}",
"dataAPIDescription": "{dataAPIDesc, select, gametools{[Recommend] Provided by gametools.network. You can check the players with hidden records and support UID query, so you don''t need to worry about changing your name. However, its server performance is average and it may have problems with jerking.} bftracker{[Not open temporarily] Unofficial requests are made to battlefieldtracker.com, whose servers are more stable, but the requests may be blocked. In addition, the data is not as detailed as that of gametools and can only be accessed by nicknames, not by players with hidden scores, which are also affected by name changes.} other{default}}",
"@dataAPIDescription": {
"description": "Description of the data API",
"placeholders": {
Expand Down Expand Up @@ -122,7 +122,7 @@
"@upgradeDiscoveryTitle": {
"description": "Title of the upgrade discovery"
},
"playerInfoScreenTabItem": "{tabs, select, overview{Overview} weapons{Weapons} vehicles{Vehicles} gadgets{Gadgets} classes{Characters} gamemodes{Game Modes} maps{Maps} other{tabs}}",
"playerInfoScreenTabItem": "{tabs, select, overview{Overview} weapons{Weapons} vehicles{Vehicles} gadgets{Gadgets} classes{Characters} gamemodes{Game Modes} maps{Maps} other{default}}",
"@playerInfoScreenTabItem": {
"description": "Tab item of the player info screen",
"placeholders": {
Expand Down Expand Up @@ -243,7 +243,7 @@
}
}
},
"bfbanStatus": "{bfbanStatus, select, neterr{Network Error} searching{Searching...} norecord{No record} waiting{Waiting for checking} hacker{Confirmed Hacker} needprovidingproof{need to provide} moss{Innocence By MOSS} invalid{Invalid reports} checking{Waiting for confirming} vote{Need more proof} null{null} pve{Not Hacker} other{Unknown}}",
"bfbanStatus": "{bfbanStatus, select, neterr{Network Error} searching{Searching...} norecord{No record} waiting{Waiting for checking} hacker{Confirmed Hacker} needprovidingproof{need to provide} moss{Innocence By MOSS} invalid{Invalid reports} checking{Waiting for confirming} vote{Need more proof} null{null} pve{Not Hacker} other{default}}",
"@bfbanStatus": {
"description": "Status of the BFBan",
"placeholders": {
Expand Down Expand Up @@ -322,7 +322,7 @@
"@repairs": {
"description": "Repairs"
},
"characterName": "{characterName, select, Mackay{Mackay} Irish{Irish} Sundance{Sundance} Dozer{Dozer} Paik{Paik} Falck{Falck} Angel{Angel} Boris{Boris} Casper{Casper} Rao{Rao} Lis{Lis} Crawford{Crawford} Zain{Zain} Blasco{Blasco} BF3Support{BF3 Support} BF3Engineer{BF3 Engineer} BF3Recon{BF3 Recon} BF3Assault{BF3 Assault} BC2Assault{BC2 Assault} BC2Medic{BC2 Medic} BC2Engineer{BC2 Engineer} BC2Recon{BC2 Recon} BF1942Assault{1942 Assault} BF1942Medic{1942 Medic} BF1942Engineer{1942 Engineer} BF1942Scout{1942 Scout} BF1942Antitank{1942 Anti-tank} other{characterName}}",
"characterName": "{characterName, select, Mackay{Mackay} Irish{Irish} Sundance{Sundance} Dozer{Dozer} Paik{Paik} Falck{Falck} Angel{Angel} Boris{Boris} Casper{Casper} Rao{Rao} Lis{Lis} Crawford{Crawford} Zain{Zain} Blasco{Blasco} BF3Support{BF3 Support} BF3Engineer{BF3 Engineer} BF3Recon{BF3 Recon} BF3Assault{BF3 Assault} BC2Assault{BC2 Assault} BC2Medic{BC2 Medic} BC2Engineer{BC2 Engineer} BC2Recon{BC2 Recon} BF1942Assault{1942 Assault} BF1942Medic{1942 Medic} BF1942Engineer{1942 Engineer} BF1942Scout{1942 Scout} BF1942Antitank{1942 Anti-tank} other{default}}",
"@characterName": {
"description": "Character name",
"placeholders": {
Expand Down Expand Up @@ -431,7 +431,7 @@
"@objectDestroyedTitle": {
"description": "Title of the object destroyed"
},
"weaponDataType": "{weaponDataType, select, killsPerMinute{KPM} timePlayed{Time} headshotRate{HS Rate} accuracy{Accuracy} efficiency{Efficiency} other{weaponDataType}}",
"weaponDataType": "{weaponDataType, select, killsPerMinute{KPM} timePlayed{Time} headshotRate{HS Rate} accuracy{Accuracy} efficiency{Efficiency} other{default}}",
"@weaponDataType": {
"description": "Data type of the weapon",
"placeholders": {
Expand All @@ -450,7 +450,7 @@
}
}
},
"vehicleDataType": "{vehicleDataType, select, killsPerMinute{KPM} timePlayed{Time} destroyCount{Destroyed Vehicles} other{vehicleDataType}}",
"vehicleDataType": "{vehicleDataType, select, killsPerMinute{KPM} timePlayed{Time} destroyCount{Destroyed Vehicles} other{default}}",
"@vehicleDataType": {
"description": "Data type of the vehicle",
"placeholders": {
Expand All @@ -459,7 +459,7 @@
}
}
},
"gadgetDataType": "{gadgetDataType, select, killsPerMinute{KPM} uses{Uses} destroyCount{Destroyed Vehicles} other{gadgetDataType}}",
"gadgetDataType": "{gadgetDataType, select, killsPerMinute{KPM} uses{Uses} destroyCount{Destroyed Vehicles} other{default}}",
"@gadgetDataType": {
"description": "Data type of the gadget",
"placeholders": {
Expand All @@ -468,7 +468,7 @@
}
}
},
"gameModeName": "{gameModeName, select, Breakthrough{Breakthrough} BreakthroughLarge{Breakthrough Large} Conquest{Conquest} ConquestLarge{Conquest Large} HazardZone{Hazard Zone} HazardZoneLarge{Hazard Zone Large} Rush{Rush} Custom{Custom} other{gameModeName}}",
"gameModeName": "{gameModeName, select, Breakthrough{Breakthrough} BreakthroughLarge{Breakthrough Large} Conquest{Conquest} ConquestLarge{Conquest Large} HazardZone{Hazard Zone} HazardZoneLarge{Hazard Zone Large} Rush{Rush} Custom{Custom} other{default}}",
"@gameModeName": {
"description": "Name of the game mode",
"placeholders": {
Expand All @@ -477,7 +477,7 @@
}
}
},
"mapName": "{mapName, select, Discarded{Discarded} Hourglass{Hourglass} Breakaway{Breakaway} Kaleidescope{Kaleidescope} Manifest{Manifest} Orbital{Orbital} Renewal{Renewal} BattleoftheBulge{Battle of the Bulge} AricaHarbor{Arica Harbor} Valparaiso{Valparaiso} ElAlamein{El Alamein} NoshahrCanals{Noshahr Canals} CaspianBorder{Caspian Border} Exposure{Exposure} Stranded{Stranded} Spearhead{Spearhead} Flashpoint{Flashpoint} Reclaimed{Reclaimed} Redacted{Redacted} other{mapName}}",
"mapName": "{mapName, select, Discarded{Discarded} Hourglass{Hourglass} Breakaway{Breakaway} Kaleidescope{Kaleidescope} Manifest{Manifest} Orbital{Orbital} Renewal{Renewal} BattleoftheBulge{Battle of the Bulge} AricaHarbor{Arica Harbor} Valparaiso{Valparaiso} ElAlamein{El Alamein} NoshahrCanals{Noshahr Canals} CaspianBorder{Caspian Border} Exposure{Exposure} Stranded{Stranded} Spearhead{Spearhead} Flashpoint{Flashpoint} Reclaimed{Reclaimed} Redacted{Redacted} other{default}}",
"@mapName": {
"description": "Name of the map",
"placeholders": {
Expand All @@ -498,7 +498,7 @@
"@exportPlayerStateBtnTitle": {
"description": "Title of the export player state button"
},
"exportPlayerState": "{exportPlayerState, select, success{Exported successfully !} error{Failed to export the player stat snapshot} denied{Permission denied, please allow the storage access permission} other{exportPlayerState}}",
"exportPlayerState": "{exportPlayerState, select, success{Exported successfully !} error{Failed to export the player stat snapshot} denied{Permission denied, please allow the storage access permission} other{default}}",
"@exportPlayerState": {
"description": "Tip for the export player state",
"placeholders": {
Expand Down
Loading

0 comments on commit dbdad8b

Please sign in to comment.