Skip to content

Commit

Permalink
Improve RTL support
Browse files Browse the repository at this point in the history
  • Loading branch information
zfoltin committed Mar 3, 2021
1 parent f5ea6b5 commit c9753a8
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 3 deletions.
4 changes: 2 additions & 2 deletions CountryPickerView/CountryPickerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ public class CountryPickerView: NibView {
countryDetailsLabel.font = font
countryDetailsLabel.textColor = textColor
if showCountryCodeInView && showPhoneCodeInView {
countryDetailsLabel.text = "(\(selectedCountry.code)) \(selectedCountry.phoneCode)"
countryDetailsLabel.text = "(\(selectedCountry.code)) \u{202A}\(selectedCountry.phoneCode)\u{202C}"
} else if showCountryNameInView && showPhoneCodeInView {
countryDetailsLabel.text = "(\(selectedCountry.localizedName() ?? selectedCountry.name)) \(selectedCountry.phoneCode)"
countryDetailsLabel.text = "(\(selectedCountry.localizedName() ?? selectedCountry.name)) \u{202A}\(selectedCountry.phoneCode)\u{202C}"
} else if showCountryCodeInView || showPhoneCodeInView || showCountryNameInView {
countryDetailsLabel.text = showCountryCodeInView ? selectedCountry.code
: showPhoneCodeInView ? selectedCountry.phoneCode
Expand Down
2 changes: 1 addition & 1 deletion CountryPickerView/CountryPickerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ extension CountryPickerViewController {
name = "\(name) (\(country.code))"
}
if dataSource.showPhoneCodeInList {
name = "\(name) (\(country.phoneCode))"
name = "\(name) (\u{202A}\(country.phoneCode)\u{202C})"
}
cell.imageView?.image = country.flag

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
004CA3091F705DD600B690B8 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
004CA30C1F705DD600B690B8 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
004CA30E1F705DD600B690B8 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
15254F7525F0032A000C5668 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/Main.strings; sourceTree = "<group>"; };
15254F7625F0032B000C5668 /* ar */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ar; path = ar.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
459706724723319B379BF2E4 /* Pods-CountryPickerViewDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CountryPickerViewDemo.debug.xcconfig"; path = "Pods/Target Support Files/Pods-CountryPickerViewDemo/Pods-CountryPickerViewDemo.debug.xcconfig"; sourceTree = "<group>"; };
476008F23554AD41FFB937C1 /* Pods-CountryPickerViewDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-CountryPickerViewDemo.release.xcconfig"; path = "Pods/Target Support Files/Pods-CountryPickerViewDemo/Pods-CountryPickerViewDemo.release.xcconfig"; sourceTree = "<group>"; };
9B8C8BC3DAF9C411DCD8D1C9 /* Pods_CountryPickerViewDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_CountryPickerViewDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
Expand Down Expand Up @@ -149,6 +151,7 @@
English,
en,
Base,
ar,
);
mainGroup = 004CA2F61F705DD600B690B8;
productRefGroup = 004CA3001F705DD600B690B8 /* Products */;
Expand Down Expand Up @@ -229,6 +232,7 @@
isa = PBXVariantGroup;
children = (
004CA3071F705DD600B690B8 /* Base */,
15254F7525F0032A000C5668 /* ar */,
);
name = Main.storyboard;
sourceTree = "<group>";
Expand All @@ -237,6 +241,7 @@
isa = PBXVariantGroup;
children = (
004CA30C1F705DD600B690B8 /* Base */,
15254F7625F0032B000C5668 /* ar */,
);
name = LaunchScreen.storyboard;
sourceTree = "<group>";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

63 changes: 63 additions & 0 deletions CountryPickerViewDemo/CountryPickerViewDemo/ar.lproj/Main.strings
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

/* Class = "UILabel"; text = "CountryPickerView can also be used as an independent view."; ObjectID = "1RQ-vo-NB4"; */
"1RQ-vo-NB4.text" = "CountryPickerView can also be used as an independent view.";

/* Class = "UILabel"; text = "Show phone code in list"; ObjectID = "1UF-QN-m72"; */
"1UF-QN-m72.text" = "Show phone code in list";

/* Class = "UITableViewSection"; headerTitle = "CUSTOMIZATION"; ObjectID = "40Z-Ay-ZrI"; */
"40Z-Ay-ZrI.headerTitle" = "CUSTOMIZATION";

/* Class = "UILabel"; text = "The internal Country Picker can be used independently."; ObjectID = "8So-g0-xNg"; */
"8So-g0-xNg.text" = "The internal Country Picker can be used independently.";

/* Class = "UILabel"; text = "Show ONLY preferred countries section"; ObjectID = "8aM-7z-xIV"; */
"8aM-7z-xIV.text" = "Show ONLY preferred countries section";

/* Class = "UIButton"; normalTitle = "Select a Country"; ObjectID = "Cvr-s2-9T2"; */
"Cvr-s2-9T2.normalTitle" = "Select a Country";

/* Class = "UILabel"; text = "Show country code in list"; ObjectID = "EF5-yw-4gn"; */
"EF5-yw-4gn.text" = "Show country code in list";

/* Class = "UILabel"; text = "Show phone code in view"; ObjectID = "Fga-9R-GVt"; */
"Fga-9R-GVt.text" = "Show phone code in view";

/* Class = "UILabel"; text = "CountryPickerView can be used as the left view of a phone number input text field"; ObjectID = "H3z-cJ-GdF"; */
"H3z-cJ-GdF.text" = "CountryPickerView can be used as the left view of a phone number input text field";

/* Class = "UISegmentedControl"; Jr1-AD-yBk.segmentTitles[0] = "Table View"; ObjectID = "Jr1-AD-yBk"; */
"Jr1-AD-yBk.segmentTitles[0]" = "Table View";

/* Class = "UISegmentedControl"; Jr1-AD-yBk.segmentTitles[1] = "Navigation Bar"; ObjectID = "Jr1-AD-yBk"; */
"Jr1-AD-yBk.segmentTitles[1]" = "Navigation Bar";

/* Class = "UISegmentedControl"; Jr1-AD-yBk.segmentTitles[2] = "Hidden"; ObjectID = "Jr1-AD-yBk"; */
"Jr1-AD-yBk.segmentTitles[2]" = "Hidden";

/* Class = "UINavigationItem"; title = "CountryPickerView Demo"; ObjectID = "L8o-xe-Pfv"; */
"L8o-xe-Pfv.title" = "CountryPickerView Demo";

/* Class = "UISegmentedControl"; SCL-Cv-BjI.segmentTitles[0] = "Push"; ObjectID = "SCL-Cv-BjI"; */
"SCL-Cv-BjI.segmentTitles[0]" = "Push";

/* Class = "UISegmentedControl"; SCL-Cv-BjI.segmentTitles[1] = "Present"; ObjectID = "SCL-Cv-BjI"; */
"SCL-Cv-BjI.segmentTitles[1]" = "Present";

/* Class = "UITableViewSection"; headerTitle = "USAGE"; ObjectID = "VxW-EB-0C6"; */
"VxW-EB-0C6.headerTitle" = "USAGE";

/* Class = "UILabel"; text = "Click on the view to open picker"; ObjectID = "cVo-xn-9I4"; */
"cVo-xn-9I4.text" = "Click on the view to open picker";

/* Class = "UILabel"; text = "SEARCH BAR POSITION"; ObjectID = "g5B-s5-Vai"; */
"g5B-s5-Vai.text" = "SEARCH BAR POSITION";

/* Class = "UILabel"; text = "Show country code in view"; ObjectID = "geW-Qh-IPW"; */
"geW-Qh-IPW.text" = "Show country code in view";

/* Class = "UILabel"; text = "Show preferred countries section"; ObjectID = "u3m-oh-NBx"; */
"u3m-oh-NBx.text" = "Show preferred countries section";

/* Class = "UILabel"; text = "Show country name in view"; ObjectID = "zDT-4c-h2J"; */
"zDT-4c-h2J.text" = "Show country name in view";

0 comments on commit c9753a8

Please sign in to comment.