| 237 | } |
| 238 | |
| 239 | void Translation::RequestAndAddMap(int map_id) { |
| 240 | if (current_language.lang_dir.empty()) { |
| 241 | return; |
| 242 | } |
| 243 | |
| 244 | std::stringstream ss; |
| 245 | ss << "Map" << std::setfill('0') << std::setw(4) << map_id << ".po"; |
| 246 | std::string map_name = ss.str(); |
| 247 | |
| 248 | if (maps.find(Utils::LowerCase(map_name)) != maps.end()) { |
| 249 | // Already loaded |
| 250 | return; |
| 251 | } |
| 252 | |
| 253 | FileRequestAsync* request = AsyncHandler::RequestFile(Tr::GetCurrentTranslationFilesystem().GetFullPath(), map_name); |
| 254 | request->SetImportantFile(true); |
| 255 | map_request = request->Bind([this, map_name](FileRequestResult*) { |
| 256 | std::unique_ptr<Dictionary> dict = std::make_unique<Dictionary>(); |
| 257 | auto is = Tr::GetCurrentTranslationFilesystem().OpenInputStream(map_name); |
| 258 | if (is) { |
| 259 | ParsePoFile(std::move(is), *dict); |
| 260 | maps[Utils::LowerCase(map_name)] = std::move(dict); |
| 261 | Output::Debug("Loaded {} map .po file ({} map files loaded)", map_name, maps.size()); |
| 262 | } |
| 263 | }); |
| 264 | request->Start(); |
| 265 | } |
| 266 | |
| 267 | bool Translation::ParseLanguageFiles(std::string_view lang_id) |
| 268 | { |
no test coverage detected