diff --git a/Example/FastisExample.xcodeproj/project.pbxproj b/Example/FastisExample.xcodeproj/project.pbxproj index 2226f93..92eff59 100644 --- a/Example/FastisExample.xcodeproj/project.pbxproj +++ b/Example/FastisExample.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 1A3E7A5E2A40901600434229 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1A3E7A602A40901600434229 /* Localizable.strings */; }; F381AF9628B8C7190046383A /* Fastis in Frameworks */ = {isa = PBXBuildFile; productRef = F381AF9528B8C7190046383A /* Fastis */; }; F3FCEE47244780FE000F966E /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3FCEE46244780FE000F966E /* AppDelegate.swift */; }; F3FCEE4B244780FE000F966E /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F3FCEE4A244780FE000F966E /* ViewController.swift */; }; @@ -15,6 +16,9 @@ /* End PBXBuildFile section */ /* Begin PBXFileReference section */ + 1A3E7A5F2A40901600434229 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; + 1A3E7A612A40902000434229 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = ""; }; + 1A3E7A622A409B3A00434229 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = ""; }; CB137E4877EBDC6E87A77A4B /* Pods_FastisExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FastisExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F31CFB6B28B8C32D00364F6A /* Fastis */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = Fastis; path = ..; sourceTree = ""; }; F3FCEE43244780FE000F966E /* FastisExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FastisExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -79,6 +83,7 @@ F3FCEE4F24478100000F966E /* Assets.xcassets */, F3FCEE5124478100000F966E /* LaunchScreen.storyboard */, F3FCEE5424478100000F966E /* Info.plist */, + 1A3E7A602A40901600434229 /* Localizable.strings */, ); path = Source; sourceTree = ""; @@ -128,6 +133,8 @@ knownRegions = ( en, Base, + ar, + ru, ); mainGroup = F3FCEE3A244780FE000F966E; productRefGroup = F3FCEE44244780FE000F966E /* Products */; @@ -145,6 +152,7 @@ buildActionMask = 2147483647; files = ( F3FCEE5324478100000F966E /* LaunchScreen.storyboard in Resources */, + 1A3E7A5E2A40901600434229 /* Localizable.strings in Resources */, F3FCEE5024478100000F966E /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -164,6 +172,16 @@ /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ + 1A3E7A602A40901600434229 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 1A3E7A5F2A40901600434229 /* en */, + 1A3E7A612A40902000434229 /* ar */, + 1A3E7A622A409B3A00434229 /* ru */, + ); + name = Localizable.strings; + sourceTree = ""; + }; F3FCEE5124478100000F966E /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( @@ -179,6 +197,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -240,6 +259,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -297,7 +317,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 48KFD5698Q; + DEVELOPMENT_TEAM = 7HXSBL2C9S; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = Fastis; IPHONEOS_DEPLOYMENT_TARGET = 14.2; @@ -319,7 +339,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; - DEVELOPMENT_TEAM = 48KFD5698Q; + DEVELOPMENT_TEAM = 7HXSBL2C9S; INFOPLIST_FILE = "$(SRCROOT)/Source/Info.plist"; INFOPLIST_KEY_CFBundleDisplayName = Fastis; IPHONEOS_DEPLOYMENT_TARGET = 14.2; diff --git a/Example/Source/ar.lproj/Localizable.strings b/Example/Source/ar.lproj/Localizable.strings new file mode 100644 index 0000000..f523d50 --- /dev/null +++ b/Example/Source/ar.lproj/Localizable.strings @@ -0,0 +1,7 @@ +/* + Localizable.strings + FastisExample + + Created by Юрий Девятаев on 19.06.2023. + Copyright © 2023 RetailDriver LLC. All rights reserved. +*/ diff --git a/Example/Source/en.lproj/Localizable.strings b/Example/Source/en.lproj/Localizable.strings new file mode 100644 index 0000000..f523d50 --- /dev/null +++ b/Example/Source/en.lproj/Localizable.strings @@ -0,0 +1,7 @@ +/* + Localizable.strings + FastisExample + + Created by Юрий Девятаев on 19.06.2023. + Copyright © 2023 RetailDriver LLC. All rights reserved. +*/ diff --git a/Example/Source/ru.lproj/Localizable.strings b/Example/Source/ru.lproj/Localizable.strings new file mode 100644 index 0000000..f523d50 --- /dev/null +++ b/Example/Source/ru.lproj/Localizable.strings @@ -0,0 +1,7 @@ +/* + Localizable.strings + FastisExample + + Created by Юрий Девятаев on 19.06.2023. + Copyright © 2023 RetailDriver LLC. All rights reserved. +*/ diff --git a/Sources/Views/Controller.swift b/Sources/Views/Controller.swift index 6f1ee4b..a5bb75c 100644 --- a/Sources/Views/Controller.swift +++ b/Sources/Views/Controller.swift @@ -158,6 +158,7 @@ open class FastisController: UIViewController, JTACMonthView private var privateMinimumDate: Date? private var privateMaximumDate: Date? private var privateSelectMonthOnHeaderTap = false + private var dayFormatter = DateFormatter() private var value: Value? { didSet { self.updateSelectedShortcut() @@ -246,6 +247,8 @@ open class FastisController: UIViewController, JTACMonthView public init(config: FastisConfig = .default) { self.config = config self.appearance = config.controller + self.dayFormatter.locale = config.calendar.locale + self.dayFormatter.dateFormat = "d" super.init(nibName: nil, bundle: nil) } @@ -364,13 +367,18 @@ open class FastisController: UIViewController, JTACMonthView if let cachedConfig = self.viewConfigs[indexPath] { cell.configure(for: cachedConfig) } else { - let newConfig = DayCell.makeViewConfig( + var newConfig = DayCell.makeViewConfig( for: cellState, minimumDate: self.privateMinimumDate, maximumDate: self.privateMaximumDate, rangeValue: self.value as? FastisRange, calendar: self.config.calendar ) + + if newConfig.dateLabelText != nil { + newConfig.dateLabelText = self.dayFormatter.string(from: date) + } + self.viewConfigs[indexPath] = newConfig cell.applyConfig(self.config) cell.configure(for: newConfig)