Skip to content

Commit

Permalink
ref #90656 add example project arabic (and other) localization
Browse files Browse the repository at this point in the history
  • Loading branch information
UriyDevyataev committed Jun 19, 2023
1 parent efdf6e0 commit 02fd082
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 3 deletions.
24 changes: 22 additions & 2 deletions Example/FastisExample.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand All @@ -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 = "<group>"; };
1A3E7A612A40902000434229 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Localizable.strings; sourceTree = "<group>"; };
1A3E7A622A409B3A00434229 /* ru */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ru; path = ru.lproj/Localizable.strings; sourceTree = "<group>"; };
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 = "<group>"; };
F3FCEE43244780FE000F966E /* FastisExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FastisExample.app; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -79,6 +83,7 @@
F3FCEE4F24478100000F966E /* Assets.xcassets */,
F3FCEE5124478100000F966E /* LaunchScreen.storyboard */,
F3FCEE5424478100000F966E /* Info.plist */,
1A3E7A602A40901600434229 /* Localizable.strings */,
);
path = Source;
sourceTree = "<group>";
Expand Down Expand Up @@ -128,6 +133,8 @@
knownRegions = (
en,
Base,
ar,
ru,
);
mainGroup = F3FCEE3A244780FE000F966E;
productRefGroup = F3FCEE44244780FE000F966E /* Products */;
Expand All @@ -145,6 +152,7 @@
buildActionMask = 2147483647;
files = (
F3FCEE5324478100000F966E /* LaunchScreen.storyboard in Resources */,
1A3E7A5E2A40901600434229 /* Localizable.strings in Resources */,
F3FCEE5024478100000F966E /* Assets.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand All @@ -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 = "<group>";
};
F3FCEE5124478100000F966E /* LaunchScreen.storyboard */ = {
isa = PBXVariantGroup;
children = (
Expand All @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions Example/Source/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Localizable.strings
FastisExample

Created by Юрий Девятаев on 19.06.2023.
Copyright © 2023 RetailDriver LLC. All rights reserved.
*/
7 changes: 7 additions & 0 deletions Example/Source/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Localizable.strings
FastisExample

Created by Юрий Девятаев on 19.06.2023.
Copyright © 2023 RetailDriver LLC. All rights reserved.
*/
7 changes: 7 additions & 0 deletions Example/Source/ru.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Localizable.strings
FastisExample

Created by Юрий Девятаев on 19.06.2023.
Copyright © 2023 RetailDriver LLC. All rights reserved.
*/
10 changes: 9 additions & 1 deletion Sources/Views/Controller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ open class FastisController<Value: FastisValue>: 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()
Expand Down Expand Up @@ -246,6 +247,8 @@ open class FastisController<Value: FastisValue>: UIViewController, JTACMonthView
public init(config: FastisConfig = .default) {
self.config = config
self.appearance = config.controller
self.dayFormatter.locale = Locale.current
self.dayFormatter.dateFormat = "d"
super.init(nibName: nil, bundle: nil)
}

Expand Down Expand Up @@ -364,13 +367,18 @@ open class FastisController<Value: FastisValue>: 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)
Expand Down

0 comments on commit 02fd082

Please sign in to comment.