From 790f0014e6a893dd39489368bc70579e705f9559 Mon Sep 17 00:00:00 2001 From: Andrew Shkrob Date: Thu, 3 Oct 2024 16:13:06 +0200 Subject: [PATCH] [core] Automatically generate core localization before build Signed-off-by: Andrew Shkrob --- CMakeLists.txt | 1 + base/CMakeLists.txt | 2 - base/strings_bundle.cpp | 25 -- cmake/OmimHelpers.cmake | 1 + drape_frontend/CMakeLists.txt | 1 + drape_frontend/drape_engine.hpp | 2 +- .../CoreApi/CoreApi.xcodeproj/project.pbxproj | 4 + iphone/Maps/Maps.xcodeproj/project.pbxproj | 4 + localization/CMakeLists.txt | 25 ++ .../generator/generate_core_localizations.py | 113 ++++++ localization/generator/localizations.hpp.in | 20 + .../generator/strings_to_generate.txt | 6 + localization/strings_bundle.cpp | 24 ++ {base => localization}/strings_bundle.hpp | 12 +- map/CMakeLists.txt | 1 + map/bookmark_manager.cpp | 2 +- map/bookmark_manager.hpp | 5 +- map/framework.cpp | 22 +- map/framework.hpp | 7 +- map/map_tests/bookmarks_test.cpp | 10 +- map/routing_manager.hpp | 2 +- map/transit/transit_display.cpp | 8 +- map/transit/transit_display.hpp | 2 +- xcode/base/base.xcodeproj/project.pbxproj | 8 - xcode/common.xcconfig | 4 +- .../drape_frontend.xcodeproj/project.pbxproj | 14 + .../localization.xcodeproj/project.pbxproj | 346 ++++++++++++++++++ xcode/map/map.xcodeproj/project.pbxproj | 4 + .../omim.xcworkspace/contents.xcworkspacedata | 3 + 29 files changed, 606 insertions(+), 72 deletions(-) delete mode 100644 base/strings_bundle.cpp create mode 100644 localization/CMakeLists.txt create mode 100644 localization/generator/generate_core_localizations.py create mode 100644 localization/generator/localizations.hpp.in create mode 100644 localization/generator/strings_to_generate.txt create mode 100644 localization/strings_bundle.cpp rename {base => localization}/strings_bundle.hpp (53%) create mode 100644 xcode/localization/localization.xcodeproj/project.pbxproj diff --git a/CMakeLists.txt b/CMakeLists.txt index aaa5939e7d..15822687c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -364,6 +364,7 @@ add_subdirectory(generator/mwm_diff) add_subdirectory(geometry) add_subdirectory(indexer) add_subdirectory(kml) +add_subdirectory(localization) add_subdirectory(map) add_subdirectory(cppjansson) add_subdirectory(platform) diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 70cdbd3998..903bf4916e 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -73,8 +73,6 @@ set(SRC stl_iterator.hpp string_utils.cpp string_utils.hpp - strings_bundle.cpp - strings_bundle.hpp suffix_array.cpp suffix_array.hpp sunrise_sunset.cpp diff --git a/base/strings_bundle.cpp b/base/strings_bundle.cpp deleted file mode 100644 index f840674fc6..0000000000 --- a/base/strings_bundle.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#include "base/strings_bundle.hpp" - -void StringsBundle::SetDefaultString(std::string const & name, std::string const & value) -{ - m_defValues[name] = value; -} - -void StringsBundle::SetString(std::string const & name, std::string const & value) -{ - m_values[name] = value; -} - -std::string const StringsBundle::GetString(std::string const & name) const -{ - TStringMap::const_iterator it = m_values.find(name); - if (it != m_values.end()) - return it->second; - else - { - it = m_defValues.find(name); - if (it != m_defValues.end()) - return it->second; - } - return ""; -} diff --git a/cmake/OmimHelpers.cmake b/cmake/OmimHelpers.cmake index 4dad95eed6..428ca609f0 100644 --- a/cmake/OmimHelpers.cmake +++ b/cmake/OmimHelpers.cmake @@ -49,6 +49,7 @@ endfunction() function(omim_add_library library) add_library(${library} ${ARGN}) + add_library(om::${library} ALIAS ${library}) # Enable warnings for all our libraries. target_compile_options(${library} PRIVATE ${OMIM_WARNING_FLAGS}) diff --git a/drape_frontend/CMakeLists.txt b/drape_frontend/CMakeLists.txt index 472346ab74..a81bc471bf 100644 --- a/drape_frontend/CMakeLists.txt +++ b/drape_frontend/CMakeLists.txt @@ -211,6 +211,7 @@ set(SRC omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} + om::localization editor drape indexer diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index ddcd7bc0e1..a7c9427734 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -28,7 +28,7 @@ #include "geometry/screenbase.hpp" #include "geometry/triangle2d.hpp" -#include "base/strings_bundle.hpp" +#include "localization/strings_bundle.hpp" #include #include diff --git a/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj b/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj index 85c83a62e9..637acf68be 100644 --- a/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj +++ b/iphone/CoreApi/CoreApi.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 16CF953F2CB00C92005174C3 /* liblocalization.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16CF953E2CB00C92005174C3 /* liblocalization.a */; }; 470015F42342509C00EBF03D /* CoreApi.h in Headers */ = {isa = PBXBuildFile; fileRef = 470015F22342509C00EBF03D /* CoreApi.h */; settings = {ATTRIBUTES = (Public, ); }; }; 471527392491EDAA00E91BBA /* MWMBookmarkColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 471527382491EDA400E91BBA /* MWMBookmarkColor.h */; settings = {ATTRIBUTES = (Public, ); }; }; 4718C4322355FC3C00640DF1 /* MWMNetworkPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 4718C4302355FC3C00640DF1 /* MWMNetworkPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -92,6 +93,7 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 16CF953E2CB00C92005174C3 /* liblocalization.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = liblocalization.a; sourceTree = BUILT_PRODUCTS_DIR; }; 470015EF2342509C00EBF03D /* CoreApi.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CoreApi.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 470015F22342509C00EBF03D /* CoreApi.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CoreApi.h; sourceTree = ""; }; 470015F32342509C00EBF03D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -189,6 +191,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 16CF953F2CB00C92005174C3 /* liblocalization.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -246,6 +249,7 @@ 4700161123425CFC00EBF03D /* Frameworks */ = { isa = PBXGroup; children = ( + 16CF953E2CB00C92005174C3 /* liblocalization.a */, FAA6D8CF29205D2D00E8D50D /* libcppjansson.a */, 4700161223425CFD00EBF03D /* UIKit.framework */, ); diff --git a/iphone/Maps/Maps.xcodeproj/project.pbxproj b/iphone/Maps/Maps.xcodeproj/project.pbxproj index 0ddb5fa2df..ba0ff0b5e2 100644 --- a/iphone/Maps/Maps.xcodeproj/project.pbxproj +++ b/iphone/Maps/Maps.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 039371B62C5B68CD00708377 /* UIFont+monospaced.swift in Sources */ = {isa = PBXBuildFile; fileRef = 039371B52C5B68CD00708377 /* UIFont+monospaced.swift */; }; + 16CF953A2CB002DC005174C3 /* liblocalization.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16CF95392CB002DC005174C3 /* liblocalization.a */; }; 1DFA2F6A20D3B57400FB2C66 /* UIColor+PartnerColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1DFA2F6920D3B57400FB2C66 /* UIColor+PartnerColor.m */; }; 3304306D21D4EAFB00317CA3 /* SearchCategoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3304306C21D4EAFB00317CA3 /* SearchCategoryCell.swift */; }; 33046832219C57180041F3A8 /* CategorySettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33046831219C57180041F3A8 /* CategorySettingsViewController.swift */; }; @@ -746,6 +747,7 @@ /* Begin PBXFileReference section */ 039371B52C5B68CD00708377 /* UIFont+monospaced.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIFont+monospaced.swift"; sourceTree = ""; }; + 16CF95392CB002DC005174C3 /* liblocalization.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = liblocalization.a; sourceTree = BUILT_PRODUCTS_DIR; }; 1D3623240D0F684500981E51 /* MapsAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MapsAppDelegate.h; sourceTree = ""; }; 1D3623250D0F684500981E51 /* MapsAppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; lineEnding = 0; path = MapsAppDelegate.mm; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 1DFA2F6820D3B52F00FB2C66 /* UIColor+PartnerColor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIColor+PartnerColor.h"; sourceTree = ""; }; @@ -1756,6 +1758,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 16CF953A2CB002DC005174C3 /* liblocalization.a in Frameworks */, FAF9DDA32A86DC54000D7037 /* libharfbuzz.a in Frameworks */, FA456C3C26BDC6AD00B83C20 /* Chart.framework in Frameworks */, FA853BF326BC5DE50026D455 /* libshaders.a in Frameworks */, @@ -1901,6 +1904,7 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + 16CF95392CB002DC005174C3 /* liblocalization.a */, FAF9DDA22A86DC54000D7037 /* libharfbuzz.a */, FA456C3B26BDC6AD00B83C20 /* Chart.framework */, FA853BF226BC5DE50026D455 /* libshaders.a */, diff --git a/localization/CMakeLists.txt b/localization/CMakeLists.txt new file mode 100644 index 0000000000..b4fba8a1c7 --- /dev/null +++ b/localization/CMakeLists.txt @@ -0,0 +1,25 @@ +project(localization) + +set(DATA_STRINGS_DIR ${OMIM_ROOT}/data/strings/) +set(GENERATOR ${PROJECT_SOURCE_DIR}/generator) +set(STRINGS_TO_GENERATE ${GENERATOR}/strings_to_generate.txt) +set(GENERATOR_TEMPLATE_FILE ${GENERATOR}/localizations.hpp.in) +set(OUTPUT_FOLDER ${PROJECT_BINARY_DIR}/generated) +set(GENERATOR_OUTPUT_FILE ${OUTPUT_FOLDER}/localization/localization.hpp) + +add_custom_command( + OUTPUT ${GENERATOR_OUTPUT_FILE} + COMMAND Python3::Interpreter ${GENERATOR}/generate_core_localizations.py + --template ${GENERATOR_TEMPLATE_FILE} + --strings-dir ${DATA_STRINGS_DIR} + --generate ${STRINGS_TO_GENERATE} + --output ${GENERATOR_OUTPUT_FILE} + DEPENDS ${DATA_STRINGS_DIR} + DEPENDS ${GENERATOR} + COMMENT "Generating core localizations" +) + +set(SRC strings_bundle.hpp strings_bundle.cpp) + +omim_add_library(${PROJECT_NAME} ${SRC} ${GENERATOR_OUTPUT_FILE}) +target_include_directories(${PROJECT_NAME} PUBLIC ${OUTPUT_FOLDER}) diff --git a/localization/generator/generate_core_localizations.py b/localization/generator/generate_core_localizations.py new file mode 100644 index 0000000000..ebdbb5c5aa --- /dev/null +++ b/localization/generator/generate_core_localizations.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python3 + +import argparse +import os +from pathlib import Path +from typing import List, Dict, Optional + + +def get_string_from_file(filename: str) -> List[str]: + strings = [] + with open(filename, 'r') as f: + for string in f: + strings.append(string.strip()) + return strings + + +def get_data_inside_brackets(line: str) -> Optional[str]: + start = line.find('[') + end = line.find(']') + + if start != -1 and end != -1 and start < end: + return line[start + 1:end] + return None + + +def is_all_translations_found(localized_strings: Dict[str, str], strings: List[str]): + missing_keys = [key for key in strings if key not in localized_strings] + + if missing_keys: + raise Exception(f'Could not find translations for strings: {missing_keys}') + + +def get_localized_strings(strings: List[str], strings_dir: Path, locale: str = "en") -> Dict[str, str]: + localized_string_prefix = f'{locale} = ' + localized_strings = {} + for file in strings_dir.iterdir(): + if not file.suffix == '.txt': + continue + with file.open('r') as f: + for line in f: + str_name = get_data_inside_brackets(line) + if str_name and str_name in strings: + for translation in f: + if translation.strip() == '': + break + prefix_pos = translation.find(localized_string_prefix) + if prefix_pos != -1: + localized_string = translation[prefix_pos + len(localized_string_prefix):].strip() + localized_strings[str_name] = localized_string + + is_all_translations_found(localized_strings, strings) + + return localized_strings + + +def generate_output_file_from_template(localized_strings: Dict[str, str], template: Path) -> str: + template_data = template.read_text() + + generated_data = "" + for key in localized_strings: + key_name = f'k{"".join([part.capitalize() for part in key.split("_")])}' + generated_data += f'static const std::string {key_name} = "{key}";\n' + template_data = template_data.replace('@GENERATE_CONSTANTS@\n', generated_data) + + generated_data = "" + for key, value in localized_strings.items(): + generated_data += f' def_values["{key}"] = "{value}";\n' + + return template_data.replace('@GENERATE_INIT@\n', generated_data) + + +def save_file(data: str, output: Path) -> None: + if output.exists(): + os.remove(output) + output.write_text(data) + + +def main(): + # Create argument parser + parser = argparse.ArgumentParser(description="Generate core localizations header.") + + # Define required arguments + parser.add_argument('--template', required=True, help='Output file template') + parser.add_argument('--strings-dir', required=True, help='Directory containing the strings data') + parser.add_argument('--generate', required=True, help='File path with strings to generate') + parser.add_argument('--output', required=True, help='Output file path for the generated localizations header') + + # Parse arguments + args = parser.parse_args() + + template_file = Path(args.template) + strings_dir = Path(args.strings_dir) + strings_to_generate = Path(args.generate) + output_file = Path(args.output) + + if not os.path.isfile(template_file): + raise Exception(f"The output template file {template_file} does not exist.") + + if not os.path.isdir(strings_dir): + raise Exception(f"The strings directory '{strings_dir}' does not exist.\n") + + if not os.path.isfile(strings_to_generate): + raise Exception(f"The strings to generate file {strings_to_generate} does not exist.") + + strings: List[str] = get_string_from_file(args.generate) + print(f"Generating localizations for: {', '.join(strings)}") + localized_strings: Dict[str, str] = get_localized_strings(strings, strings_dir) + output_file_data: str = generate_output_file_from_template(localized_strings, template_file) + save_file(output_file_data, output_file) + + +if __name__ == "__main__": + main() diff --git a/localization/generator/localizations.hpp.in b/localization/generator/localizations.hpp.in new file mode 100644 index 0000000000..33242c24a5 --- /dev/null +++ b/localization/generator/localizations.hpp.in @@ -0,0 +1,20 @@ +// Autogenerated file +// DO NOT EDIT! + +#pragma once + +#include +#include + +namespace om::localization +{ +@GENERATE_CONSTANTS@ + +namespace init +{ +inline void SetDefaultStrings(std::map & def_values) +{ +@GENERATE_INIT@ +} +} // namespace init +} // namespace om::localization diff --git a/localization/generator/strings_to_generate.txt b/localization/generator/strings_to_generate.txt new file mode 100644 index 0000000000..96da8233b2 --- /dev/null +++ b/localization/generator/strings_to_generate.txt @@ -0,0 +1,6 @@ +core_entrance +core_exit +core_placepage_unknown_place +core_my_places +core_my_position +postal_code diff --git a/localization/strings_bundle.cpp b/localization/strings_bundle.cpp new file mode 100644 index 0000000000..0667b3207c --- /dev/null +++ b/localization/strings_bundle.cpp @@ -0,0 +1,24 @@ +#include "strings_bundle.hpp" + +namespace om::localization +{ +const std::string StringsBundle::kEmpty = ""; + +StringsBundle::StringsBundle() { init::SetDefaultStrings(m_defValues); } + +void StringsBundle::SetString(std::string const & name, std::string const & value) { m_values[name] = value; } + +std::string const & StringsBundle::GetString(std::string const & name) const +{ + auto it = m_values.find(name); + if (it != m_values.end()) + return it->second; + else + { + it = m_defValues.find(name); + if (it != m_defValues.end()) + return it->second; + } + return kEmpty; +} +} // namespace om::localization diff --git a/base/strings_bundle.hpp b/localization/strings_bundle.hpp similarity index 53% rename from base/strings_bundle.hpp rename to localization/strings_bundle.hpp index 53e44ef965..1712e25ac1 100644 --- a/base/strings_bundle.hpp +++ b/localization/strings_bundle.hpp @@ -3,14 +3,22 @@ #include #include +#include "localization/localization.hpp" + +namespace om::localization +{ class StringsBundle { + static const std::string kEmpty; + using TStringMap = std::map; TStringMap m_values; TStringMap m_defValues; public: - void SetDefaultString(std::string const & name, std::string const & value); + StringsBundle(); + void SetString(std::string const & name, std::string const & value); - std::string const GetString(std::string const & name) const; + std::string const & GetString(std::string const & name) const; }; +} // namespace om::localization diff --git a/map/CMakeLists.txt b/map/CMakeLists.txt index 2bd9dc7c6a..e9b0ebe990 100644 --- a/map/CMakeLists.txt +++ b/map/CMakeLists.txt @@ -85,6 +85,7 @@ endif() omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} + om::localization routing indexer search diff --git a/map/bookmark_manager.cpp b/map/bookmark_manager.cpp index a40b96e72a..4de2f97c58 100644 --- a/map/bookmark_manager.cpp +++ b/map/bookmark_manager.cpp @@ -2587,7 +2587,7 @@ kml::MarkGroupId BookmarkManager::CheckAndCreateDefaultCategory() { CHECK_THREAD_CHECKER(m_threadChecker, ()); if (m_categories.empty()) - return CreateBookmarkCategory(m_callbacks.m_getStringsBundle().GetString("core_my_places")); + return CreateBookmarkCategory(m_callbacks.m_getStringsBundle().GetString(om::localization::kCoreMyPlaces)); return m_categories.cbegin()->first; } diff --git a/map/bookmark_manager.hpp b/map/bookmark_manager.hpp index 0f65e7163c..39fbd02ecd 100644 --- a/map/bookmark_manager.hpp +++ b/map/bookmark_manager.hpp @@ -16,10 +16,11 @@ #include "geometry/screenbase.hpp" #include "base/macros.hpp" -#include "base/strings_bundle.hpp" #include "base/thread_checker.hpp" #include "base/visitor.hpp" +#include "localization/strings_bundle.hpp" + #include #include #include @@ -71,7 +72,7 @@ public: struct Callbacks { - using GetStringsBundleFn = std::function; + using GetStringsBundleFn = std::function; using GetSeacrhAPIFn = std::function; using CreatedBookmarksCallback = std::function const &)>; using UpdatedBookmarksCallback = std::function const &)>; diff --git a/map/framework.cpp b/map/framework.cpp index 6c98e8e030..2d83974e8e 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -275,7 +275,7 @@ Framework::Framework(FrameworkParams const & params, bool loadMaps) [this]() -> DataSource & { return m_featuresFetcher.GetDataSource(); }, [this]() -> storage::CountryInfoGetter const & { return GetCountryInfoGetter(); }, [this](string const & id) -> string { return m_storage.GetParentIdFor(id); }, - [this]() -> StringsBundle const & { return m_stringsBundle; }, + [this]() -> om::localization::StringsBundle const & { return m_stringsBundle; }, [this]() -> power_management::PowerManager const & { return m_powerManager; }), static_cast(*this)) , m_trafficManager(bind(&Framework::GetMwmsByRect, this, _1, false /* rough */), @@ -299,16 +299,6 @@ Framework::Framework(FrameworkParams const & params, bool loadMaps) m_connectToGpsTrack = GpsTracker::Instance().IsEnabled(); - // Init strings bundle. - // @TODO. There are hardcoded strings below which are defined in strings.txt as well. - // It's better to use strings from strings.txt instead of hardcoding them here. - m_stringsBundle.SetDefaultString("core_entrance", "Entrance"); - m_stringsBundle.SetDefaultString("core_exit", "Exit"); - m_stringsBundle.SetDefaultString("core_placepage_unknown_place", "Unknown Place"); - m_stringsBundle.SetDefaultString("core_my_places", "My Places"); - m_stringsBundle.SetDefaultString("core_my_position", "My Position"); - m_stringsBundle.SetDefaultString("postal_code", "Postal Code"); - m_featuresFetcher.InitClassificator(); m_featuresFetcher.SetOnMapDeregisteredCallback(bind(&Framework::OnMapDeregistered, this, _1)); LOG(LDEBUG, ("Classificator initialized")); @@ -323,7 +313,7 @@ Framework::Framework(FrameworkParams const & params, bool loadMaps) LOG(LDEBUG, ("Search API initialized, part 1")); m_bmManager = make_unique(BookmarkManager::Callbacks( - [this]() -> StringsBundle const & { return m_stringsBundle; }, + [this]() -> om::localization::StringsBundle const & { return m_stringsBundle; }, [this]() -> SearchAPI & { return GetSearchAPI(); }, [this](vector const & marks) { GetSearchAPI().OnBookmarksCreated(marks); }, [this](vector const & marks) { GetSearchAPI().OnBookmarksUpdated(marks); }, @@ -701,7 +691,7 @@ void Framework::FillNotMatchedPlaceInfo(place_page::Info & info, m2::PointD cons std::string const & customTitle /* = {} */) const { if (customTitle.empty()) - info.SetCustomNameWithCoordinates(mercator, m_stringsBundle.GetString("core_placepage_unknown_place")); + info.SetCustomNameWithCoordinates(mercator, m_stringsBundle.GetString(om::localization::kCorePlacepageUnknownPlace)); else info.SetCustomName(customTitle); info.SetCanEditOrAdd(CanEditMapForPosition(mercator)); @@ -711,7 +701,7 @@ void Framework::FillNotMatchedPlaceInfo(place_page::Info & info, m2::PointD cons void Framework::FillPostcodeInfo(string const & postcode, m2::PointD const & mercator, place_page::Info & info) const { - info.SetCustomNames(postcode, m_stringsBundle.GetString("postal_code")); + info.SetCustomNames(postcode, m_stringsBundle.GetString(om::localization::kPostalCode)); info.SetMercator(mercator); } @@ -774,7 +764,7 @@ void Framework::FillMyPositionInfo(place_page::Info & info, place_page::BuildInf auto const position = GetCurrentPosition(); CHECK(position, ()); info.SetMercator(*position); - info.SetCustomName(m_stringsBundle.GetString("core_my_position")); + info.SetCustomName(m_stringsBundle.GetString(om::localization::kCoreMyPosition)); UserMark const * mark = FindUserMarkInTapPosition(buildInfo); if (mark != nullptr && mark->GetMarkType() == UserMark::Type::ROUTING) @@ -2335,7 +2325,7 @@ void Framework::PredictLocation(double & lat, double & lon, double accuracy, lat = mercator::YToLat(mercatorPt.y); } -StringsBundle const & Framework::GetStringsBundle() +om::localization::StringsBundle const & Framework::GetStringsBundle() { return m_stringsBundle; } diff --git a/map/framework.hpp b/map/framework.hpp index 53ef163860..ffe6204dd3 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -54,7 +54,8 @@ #include "geometry/screenbase.hpp" #include "base/macros.hpp" -#include "base/strings_bundle.hpp" + +#include "localization/strings_bundle.hpp" #include "std/target_os.hpp" @@ -140,7 +141,7 @@ private: protected: using TDrapeFunction = std::function; - StringsBundle m_stringsBundle; + om::localization::StringsBundle m_stringsBundle; FeaturesFetcher m_featuresFetcher; @@ -652,7 +653,7 @@ public: m_stringsBundle.SetString(name, value); } - StringsBundle const & GetStringsBundle(); + om::localization::StringsBundle const & GetStringsBundle(); /// [in] lat, lon - last known location /// [out] lat, lon - predicted location diff --git a/map/map_tests/bookmarks_test.cpp b/map/map_tests/bookmarks_test.cpp index cfaa5cb45b..d45ba6ca91 100644 --- a/map/map_tests/bookmarks_test.cpp +++ b/map/map_tests/bookmarks_test.cpp @@ -134,10 +134,10 @@ char const * kmlString = "" ""; -#define BM_CALLBACKS { \ - []() -> StringsBundle const & \ +#define BM_CALLBACKS { \ + []() -> om::localization::StringsBundle const & \ { \ - static StringsBundle const dummyBundle; \ + static om::localization::StringsBundle const dummyBundle; \ return dummyBundle; \ }, \ static_cast(nullptr), \ @@ -1261,9 +1261,9 @@ UNIT_CLASS_TEST(Runner, Bookmarks_Listeners) }; BookmarkManager::Callbacks callbacks( - []() -> StringsBundle const & + []() -> om::localization::StringsBundle const & { - static StringsBundle const dummyBundle; + static om::localization::StringsBundle const dummyBundle; return dummyBundle; }, static_cast(nullptr), diff --git a/map/routing_manager.hpp b/map/routing_manager.hpp index 0141d16ab0..ed69aa6d04 100644 --- a/map/routing_manager.hpp +++ b/map/routing_manager.hpp @@ -76,7 +76,7 @@ public: using DataSourceGetterFn = std::function; using CountryInfoGetterFn = std::function; using CountryParentNameGetterFn = std::function; - using GetStringsBundleFn = std::function; + using GetStringsBundleFn = std::function; using PowerManagerGetter = std::function; template ; - using GetStringsBundleFn = std::function; + using GetStringsBundleFn = std::function; TransitRouteDisplay(TransitReadManager & transitReadManager, GetMwmIdFn const & getMwmIdFn, GetStringsBundleFn const & getStringsBundleFn, BookmarkManager * bmManager, diff --git a/xcode/base/base.xcodeproj/project.pbxproj b/xcode/base/base.xcodeproj/project.pbxproj index fc45f5fc66..f3b740869b 100644 --- a/xcode/base/base.xcodeproj/project.pbxproj +++ b/xcode/base/base.xcodeproj/project.pbxproj @@ -124,8 +124,6 @@ 675341FE1A3F57E400A0A8C3 /* stl_iterator.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675341B91A3F57E400A0A8C3 /* stl_iterator.hpp */; }; 675342011A3F57E400A0A8C3 /* string_utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675341BC1A3F57E400A0A8C3 /* string_utils.cpp */; }; 675342021A3F57E400A0A8C3 /* string_utils.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675341BD1A3F57E400A0A8C3 /* string_utils.hpp */; }; - 675342031A3F57E400A0A8C3 /* strings_bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675341BE1A3F57E400A0A8C3 /* strings_bundle.cpp */; }; - 675342041A3F57E400A0A8C3 /* strings_bundle.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675341BF1A3F57E400A0A8C3 /* strings_bundle.hpp */; }; 675342061A3F57E400A0A8C3 /* thread_pool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675341C11A3F57E400A0A8C3 /* thread_pool.cpp */; }; 675342071A3F57E400A0A8C3 /* thread_pool.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 675341C21A3F57E400A0A8C3 /* thread_pool.hpp */; }; 675342081A3F57E400A0A8C3 /* thread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 675341C31A3F57E400A0A8C3 /* thread.cpp */; }; @@ -273,8 +271,6 @@ 675341B91A3F57E400A0A8C3 /* stl_iterator.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = stl_iterator.hpp; sourceTree = ""; }; 675341BC1A3F57E400A0A8C3 /* string_utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = string_utils.cpp; sourceTree = ""; }; 675341BD1A3F57E400A0A8C3 /* string_utils.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = string_utils.hpp; sourceTree = ""; }; - 675341BE1A3F57E400A0A8C3 /* strings_bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = strings_bundle.cpp; sourceTree = ""; }; - 675341BF1A3F57E400A0A8C3 /* strings_bundle.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = strings_bundle.hpp; sourceTree = ""; }; 675341C11A3F57E400A0A8C3 /* thread_pool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = thread_pool.cpp; sourceTree = ""; }; 675341C21A3F57E400A0A8C3 /* thread_pool.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = thread_pool.hpp; sourceTree = ""; }; 675341C31A3F57E400A0A8C3 /* thread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = thread.cpp; sourceTree = ""; }; @@ -466,8 +462,6 @@ 675341B91A3F57E400A0A8C3 /* stl_iterator.hpp */, 675341BC1A3F57E400A0A8C3 /* string_utils.cpp */, 675341BD1A3F57E400A0A8C3 /* string_utils.hpp */, - 675341BE1A3F57E400A0A8C3 /* strings_bundle.cpp */, - 675341BF1A3F57E400A0A8C3 /* strings_bundle.hpp */, 3D74EF0B1F8B902B0081202C /* suffix_array.cpp */, 3917FA5E211E00C300937DF4 /* suffix_array.hpp */, 670E39421C46C76900E9C0A6 /* sunrise_sunset.cpp */, @@ -534,7 +528,6 @@ 670E39451C46C76900E9C0A6 /* sunrise_sunset.hpp in Headers */, 3D7815731F3A145F0068B6AC /* task_loop.hpp in Headers */, 675341F51A3F57E400A0A8C3 /* set_operations.hpp in Headers */, - 675342041A3F57E400A0A8C3 /* strings_bundle.hpp in Headers */, 3D1BE646212D775500ACD94A /* atomic_shared_ptr.hpp in Headers */, 672DD4C81E0425600078E13C /* stl_helpers.hpp in Headers */, 675341CE1A3F57E400A0A8C3 /* base.hpp in Headers */, @@ -745,7 +738,6 @@ 3917FA57211E009700937DF4 /* geo_object_id.cpp in Sources */, 3901B745235F02B3006ABD43 /* cancellable.cpp in Sources */, 675341F91A3F57E400A0A8C3 /* src_point.cpp in Sources */, - 675342031A3F57E400A0A8C3 /* strings_bundle.cpp in Sources */, 675341CD1A3F57E400A0A8C3 /* base.cpp in Sources */, 675342011A3F57E400A0A8C3 /* string_utils.cpp in Sources */, 674A7E2E1C0DB03D003D48E1 /* timegm.cpp in Sources */, diff --git a/xcode/common.xcconfig b/xcode/common.xcconfig index b3e19157c4..e7f7528b11 100644 --- a/xcode/common.xcconfig +++ b/xcode/common.xcconfig @@ -3,9 +3,11 @@ OMIM_ROOT = $(PROJECT_DIR)/../.. QT_PATH[arch=x86_64] = /usr/local/opt/qt@6 QT_PATH[arch=arm64] = /opt/homebrew/opt/qt@6 BOOST_ROOT = $(OMIM_ROOT)/3party/boost +CORE_LOCALIZATION_GENERATOR_PATH = $(OMIM_ROOT)/localization/generator +CORE_LOCALIZATION_GENERATOR_OUTPUT_PATH = $(BUILT_PRODUCTS_DIR)/localization // jansson is included in many libs, and is also used in headers (leaks to other libs) -HEADER_SEARCH_PATHS = $(inherited) $(OMIM_ROOT) $(BOOST_ROOT) $(OMIM_ROOT)/3party/jansson $(OMIM_ROOT)/3party/jansson/jansson/src $(OMIM_ROOT)/3party/utfcpp/source +HEADER_SEARCH_PATHS = $(inherited) $(OMIM_ROOT) $(BOOST_ROOT) $(OMIM_ROOT)/3party/jansson $(OMIM_ROOT)/3party/jansson/jansson/src $(OMIM_ROOT)/3party/utfcpp/source $(CORE_LOCALIZATION_GENERATOR_OUTPUT_PATH) FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(QT_PATH)/lib // Deployment target diff --git a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj index 27001f6b2c..f94f0b657d 100644 --- a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj +++ b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 16CF95312CAED82C005174C3 /* liblocalization.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16CF95302CAED82C005174C3 /* liblocalization.a */; }; 347F520D1DC2334A0064B273 /* drape_api_builder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 347F52071DC2334A0064B273 /* drape_api_builder.cpp */; }; 347F520E1DC2334A0064B273 /* drape_api_builder.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 347F52081DC2334A0064B273 /* drape_api_builder.hpp */; }; 347F520F1DC2334A0064B273 /* drape_api_renderer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 347F52091DC2334A0064B273 /* drape_api_renderer.cpp */; }; @@ -214,6 +215,8 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 16CF952C2CAED743005174C3 /* liblocalization.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = liblocalization.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 16CF95302CAED82C005174C3 /* liblocalization.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = liblocalization.a; sourceTree = BUILT_PRODUCTS_DIR; }; 347F52071DC2334A0064B273 /* drape_api_builder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drape_api_builder.cpp; sourceTree = ""; }; 347F52081DC2334A0064B273 /* drape_api_builder.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_api_builder.hpp; sourceTree = ""; }; 347F52091DC2334A0064B273 /* drape_api_renderer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drape_api_renderer.cpp; sourceTree = ""; }; @@ -429,12 +432,22 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 16CF95312CAED82C005174C3 /* liblocalization.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ + 16CF952B2CAED743005174C3 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 16CF95302CAED82C005174C3 /* liblocalization.a */, + 16CF952C2CAED743005174C3 /* liblocalization.a */, + ); + name = Frameworks; + sourceTree = ""; + }; 670947311BDF9B82005014C0 = { isa = PBXGroup; children = ( @@ -442,6 +455,7 @@ 34AF87CC1DBE508400E5E7DC /* common-release.xcconfig */, 670947411BDF9B99005014C0 /* drape_frontend */, 6709473B1BDF9B82005014C0 /* Products */, + 16CF952B2CAED743005174C3 /* Frameworks */, ); sourceTree = ""; }; diff --git a/xcode/localization/localization.xcodeproj/project.pbxproj b/xcode/localization/localization.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..f053100240 --- /dev/null +++ b/xcode/localization/localization.xcodeproj/project.pbxproj @@ -0,0 +1,346 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 56; + objects = { + +/* Begin PBXBuildFile section */ + 16CF95282CAEC34C005174C3 /* strings_bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 16CF95272CAEC34C005174C3 /* strings_bundle.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 16CF94FD2CADE1ED005174C3 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = "include/$(PRODUCT_NAME)"; + dstSubfolderSpec = 16; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 16CF94FF2CADE1ED005174C3 /* liblocalization.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = liblocalization.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 16CF95192CADE21C005174C3 /* common-release.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "common-release.xcconfig"; path = "../common-release.xcconfig"; sourceTree = ""; }; + 16CF951A2CADE21C005174C3 /* common-debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = "common-debug.xcconfig"; path = "../common-debug.xcconfig"; sourceTree = ""; }; + 16CF95242CAEBF1B005174C3 /* generator */ = {isa = PBXFileReference; lastKnownFileType = folder; name = generator; path = ../../../localization/generator; sourceTree = ""; }; + 16CF95262CAEC34C005174C3 /* strings_bundle.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = strings_bundle.hpp; path = ../../../localization/strings_bundle.hpp; sourceTree = ""; }; + 16CF95272CAEC34C005174C3 /* strings_bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = strings_bundle.cpp; path = ../../../localization/strings_bundle.cpp; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 16CF94FC2CADE1ED005174C3 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 16CF94F62CADE1ED005174C3 = { + isa = PBXGroup; + children = ( + 16CF95202CADE377005174C3 /* localization */, + 16CF951A2CADE21C005174C3 /* common-debug.xcconfig */, + 16CF95192CADE21C005174C3 /* common-release.xcconfig */, + 16CF95002CADE1ED005174C3 /* Products */, + ); + sourceTree = ""; + }; + 16CF95002CADE1ED005174C3 /* Products */ = { + isa = PBXGroup; + children = ( + 16CF94FF2CADE1ED005174C3 /* liblocalization.a */, + ); + name = Products; + sourceTree = ""; + }; + 16CF95202CADE377005174C3 /* localization */ = { + isa = PBXGroup; + children = ( + 16CF95272CAEC34C005174C3 /* strings_bundle.cpp */, + 16CF95262CAEC34C005174C3 /* strings_bundle.hpp */, + 16CF95242CAEBF1B005174C3 /* generator */, + ); + path = localization; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 16CF94FE2CADE1ED005174C3 /* localization */ = { + isa = PBXNativeTarget; + buildConfigurationList = 16CF95132CADE1ED005174C3 /* Build configuration list for PBXNativeTarget "localization" */; + buildPhases = ( + 16CF951B2CADE321005174C3 /* Run Generate localizations script */, + 16CF94FB2CADE1ED005174C3 /* Sources */, + 16CF94FC2CADE1ED005174C3 /* Frameworks */, + 16CF94FD2CADE1ED005174C3 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = localization; + productName = localization; + productReference = 16CF94FF2CADE1ED005174C3 /* liblocalization.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 16CF94F72CADE1ED005174C3 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = 1; + DefaultBuildSystemTypeForWorkspace = Latest; + LastUpgradeCheck = 1500; + TargetAttributes = { + 16CF94FE2CADE1ED005174C3 = { + CreatedOnToolsVersion = 15.0; + }; + }; + }; + buildConfigurationList = 16CF94FA2CADE1ED005174C3 /* Build configuration list for PBXProject "localization" */; + compatibilityVersion = "Xcode 14.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 16CF94F62CADE1ED005174C3; + productRefGroup = 16CF95002CADE1ED005174C3 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 16CF94FE2CADE1ED005174C3 /* localization */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + 16CF951B2CADE321005174C3 /* Run Generate localizations script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputFileListPaths = ( + ); + inputPaths = ( + "$(CORE_LOCALIZATION_GENERATOR_PATH)/localizations.hpp.in", + "$(OMIM_ROOT)/data/strings", + "$(CORE_LOCALIZATION_GENERATOR_PATH)/strings_to_generate.txt", + ); + name = "Run Generate localizations script"; + outputFileListPaths = ( + ); + outputPaths = ( + "$(CORE_LOCALIZATION_GENERATOR_OUTPUT_PATH)/localization/localization.hpp", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "python3 ${CORE_LOCALIZATION_GENERATOR_PATH}/generate_core_localizations.py --template ${SCRIPT_INPUT_FILE_0} --strings-dir ${SCRIPT_INPUT_FILE_1} --generate ${SCRIPT_INPUT_FILE_2} --output ${SCRIPT_OUTPUT_FILE_0}\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 16CF94FB2CADE1ED005174C3 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 16CF95282CAEC34C005174C3 /* strings_bundle.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 16CF95112CADE1ED005174C3 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 16CF951A2CADE21C005174C3 /* common-debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; + MTL_FAST_MATH = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = ""; + WATCHOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Debug; + }; + 16CF95122CADE1ED005174C3 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 16CF95192CADE21C005174C3 /* common-release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++20"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_ENABLE_OBJC_WEAK = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = YES; + GCC_C_LANGUAGE_STANDARD = gnu17; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; + MTL_ENABLE_DEBUG_INFO = NO; + MTL_FAST_MATH = YES; + SDKROOT = ""; + VALIDATE_PRODUCT = YES; + WATCHOS_DEPLOYMENT_TARGET = 10.0; + }; + name = Release; + }; + 16CF95142CADE1ED005174C3 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 9Z6432XD7L; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(OMIM_ROOT)", + "$(BOOST_ROOT)", + "$(OMIM_ROOT)/3party/jansson", + "$(OMIM_ROOT)/3party/jansson/jansson/src", + "$(OMIM_ROOT)/3party/utfcpp/source", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Debug; + }; + 16CF95152CADE1ED005174C3 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_STYLE = Automatic; + DEVELOPMENT_TEAM = 9Z6432XD7L; + HEADER_SEARCH_PATHS = ( + "$(inherited)", + "$(OMIM_ROOT)", + "$(BOOST_ROOT)", + "$(OMIM_ROOT)/3party/jansson", + "$(OMIM_ROOT)/3party/jansson/jansson/src", + "$(OMIM_ROOT)/3party/utfcpp/source", + ); + OTHER_LDFLAGS = "-ObjC"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 16CF94FA2CADE1ED005174C3 /* Build configuration list for PBXProject "localization" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 16CF95112CADE1ED005174C3 /* Debug */, + 16CF95122CADE1ED005174C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 16CF95132CADE1ED005174C3 /* Build configuration list for PBXNativeTarget "localization" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 16CF95142CADE1ED005174C3 /* Debug */, + 16CF95152CADE1ED005174C3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 16CF94F72CADE1ED005174C3 /* Project object */; +} diff --git a/xcode/map/map.xcodeproj/project.pbxproj b/xcode/map/map.xcodeproj/project.pbxproj index 97d510969c..b00d60e8a7 100644 --- a/xcode/map/map.xcodeproj/project.pbxproj +++ b/xcode/map/map.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 0831F23C200E53600034C365 /* bookmarks_search_params.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 0831F23B200E53600034C365 /* bookmarks_search_params.hpp */; }; + 16CF952F2CAED7E2005174C3 /* liblocalization.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 16CF952E2CAED7E2005174C3 /* liblocalization.a */; }; 34583BCF1C88556800F94664 /* place_page_info.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 34583BCD1C88556800F94664 /* place_page_info.cpp */; }; 34583BD01C88556800F94664 /* place_page_info.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 34583BCE1C88556800F94664 /* place_page_info.hpp */; }; 347B60761DD9926D0050FA24 /* traffic_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 347B60741DD9926D0050FA24 /* traffic_manager.cpp */; }; @@ -149,6 +150,7 @@ /* Begin PBXFileReference section */ 0831F23B200E53600034C365 /* bookmarks_search_params.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = bookmarks_search_params.hpp; sourceTree = ""; }; + 16CF952E2CAED7E2005174C3 /* liblocalization.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = liblocalization.a; sourceTree = BUILT_PRODUCTS_DIR; }; 34583BCD1C88556800F94664 /* place_page_info.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = place_page_info.cpp; sourceTree = ""; }; 34583BCE1C88556800F94664 /* place_page_info.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = place_page_info.hpp; sourceTree = ""; }; 347B60741DD9926D0050FA24 /* traffic_manager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = traffic_manager.cpp; sourceTree = ""; }; @@ -289,6 +291,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 16CF952F2CAED7E2005174C3 /* liblocalization.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -298,6 +301,7 @@ 34DDA17E1DBE5DF40088A609 /* Frameworks */ = { isa = PBXGroup; children = ( + 16CF952E2CAED7E2005174C3 /* liblocalization.a */, FAA8388926BB3CE4002E54C6 /* libdrape.a */, FAA8388526BB3CC3002E54C6 /* libexpat.a */, FAA8388326BB3CBE002E54C6 /* libcppjansson.a */, diff --git a/xcode/omim.xcworkspace/contents.xcworkspacedata b/xcode/omim.xcworkspace/contents.xcworkspacedata index a323158abc..51ae8c6704 100644 --- a/xcode/omim.xcworkspace/contents.xcworkspacedata +++ b/xcode/omim.xcworkspace/contents.xcworkspacedata @@ -1,6 +1,9 @@ + + -- 2.45.3