From 02983834656e609e7b2936b30c0e68a9a01261dd Mon Sep 17 00:00:00 2001 From: Deniz Duezgoeren Date: Mon, 22 Jul 2019 13:38:01 +0200 Subject: [PATCH] Localisations complete, colour picker finished --- AvH Plan.xcodeproj/project.pbxproj | 4 +- .../checkmark.imageset/Contents.json | 23 ++++++ AvH Plan/Base.lproj/Main.storyboard | 11 ++- AvH Plan/ColourViewCell.swift | 1 + AvH Plan/ColourViewCell.xib | 20 +++-- AvH Plan/CustomizationViewController.swift | 11 ++- AvH Plan/DataFetcher.swift | 6 +- AvH Plan/de.lproj/Main.strings | 80 +++++++++++++++++++ 8 files changed, 144 insertions(+), 12 deletions(-) create mode 100644 AvH Plan/Assets.xcassets/checkmark.imageset/Contents.json create mode 100644 AvH Plan/de.lproj/Main.strings diff --git a/AvH Plan.xcodeproj/project.pbxproj b/AvH Plan.xcodeproj/project.pbxproj index 7ab88ac..267e78f 100644 --- a/AvH Plan.xcodeproj/project.pbxproj +++ b/AvH Plan.xcodeproj/project.pbxproj @@ -58,9 +58,9 @@ 589FBD2CE6A9C73CD9B81441 /* Pods-AvH PlanUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-AvH PlanUITests.release.xcconfig"; path = "Target Support Files/Pods-AvH PlanUITests/Pods-AvH PlanUITests.release.xcconfig"; sourceTree = ""; }; 74EDE3D8134812AB76BEB988 /* Pods_AvH_PlanUITests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AvH_PlanUITests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7605BB0678C9E27A1D3E9DAA /* Pods_AvH_Plan.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AvH_Plan.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + A920726022E5BAD8001B3D46 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = ""; }; A957A74F22DDC15500E0A2ED /* MenuViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuViewCell.swift; sourceTree = ""; }; A957A75022DDC15500E0A2ED /* MenuViewCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MenuViewCell.xib; sourceTree = ""; }; - A958A91E22DF528C007052B0 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Main.strings; sourceTree = ""; }; A958A92322DF5388007052B0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; A958A92522DF538C007052B0 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = ""; }; A961337C2299867400B541D4 /* AvH Plan.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "AvH Plan.app"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -523,7 +523,7 @@ isa = PBXVariantGroup; children = ( A96133862299867400B541D4 /* Base */, - A958A91E22DF528C007052B0 /* de */, + A920726022E5BAD8001B3D46 /* de */, ); name = Main.storyboard; sourceTree = ""; diff --git a/AvH Plan/Assets.xcassets/checkmark.imageset/Contents.json b/AvH Plan/Assets.xcassets/checkmark.imageset/Contents.json new file mode 100644 index 0000000..a2b0b46 --- /dev/null +++ b/AvH Plan/Assets.xcassets/checkmark.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "checkmark-1x.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "checkmark-2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "checkmark-3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/AvH Plan/Base.lproj/Main.storyboard b/AvH Plan/Base.lproj/Main.storyboard index 42bc7cf..81ba992 100644 --- a/AvH Plan/Base.lproj/Main.storyboard +++ b/AvH Plan/Base.lproj/Main.storyboard @@ -22,7 +22,13 @@ - + + + + + + + @@ -382,4 +388,7 @@ + + + diff --git a/AvH Plan/ColourViewCell.swift b/AvH Plan/ColourViewCell.swift index 6904fb0..c09dfa3 100644 --- a/AvH Plan/ColourViewCell.swift +++ b/AvH Plan/ColourViewCell.swift @@ -12,4 +12,5 @@ class ColourViewCell: GenericViewCell { @IBOutlet weak var colorView: UIView! @IBOutlet weak var label: UILabel! + @IBOutlet weak var imageView: UIImageView! } diff --git a/AvH Plan/ColourViewCell.xib b/AvH Plan/ColourViewCell.xib index c228d34..2e07502 100644 --- a/AvH Plan/ColourViewCell.xib +++ b/AvH Plan/ColourViewCell.xib @@ -13,27 +13,36 @@ - + - + - + - + + + + + + + + + + @@ -56,6 +65,7 @@ + diff --git a/AvH Plan/CustomizationViewController.swift b/AvH Plan/CustomizationViewController.swift index 25dfc49..af668cd 100644 --- a/AvH Plan/CustomizationViewController.swift +++ b/AvH Plan/CustomizationViewController.swift @@ -11,7 +11,8 @@ import MagazineLayout class CustomizationViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegateMagazineLayout { - let courses = ["German", "English", "French", "Spanish", "Latin", "Turkish", "Chinese", "Arts", "Music", "Theatre", "Geography", "History", "Politics", "Philosophy", "Religion", "Maths", "Biology", "Chemistry", "Physics", "CompSci", "PhysEd", "GLL", "WAT", "Forder", "WP"] + var courses = [String]() + var translatedCourses = [String]() @IBOutlet weak var collectionView: UICollectionView! let identifier = "customisation_cell" // let storyboard = UIStoryboard(name: "main", bundle: nil) @@ -27,6 +28,8 @@ class CustomizationViewController: UIViewController, UICollectionViewDataSource, override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) + courses = self.df.courses + translatedCourses = self.df.translatedCourses self.collectionView.register(UINib(nibName: "ColourViewCell", bundle: nil), forCellWithReuseIdentifier: identifier) } @@ -58,7 +61,7 @@ class CustomizationViewController: UIViewController, UICollectionViewDataSource, func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { if let s = storyboard?.instantiateViewController(withIdentifier: "ColourPickerView") as? ColourPickerView { - s.course = self.courses[indexPath.item] + s.course = self.translatedCourses[indexPath.item] s.internalCourse = self.courses[indexPath.item] s.currentIndexPath = indexPath self.present(s, animated: true) @@ -105,8 +108,10 @@ class CustomizationViewController: UIViewController, UICollectionViewDataSource, func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: identifier, for: indexPath as IndexPath) as! ColourViewCell - cell.label.text = self.courses[indexPath.item] + cell.label.text = self.translatedCourses[indexPath.item] cell.colorView.layer.cornerRadius = cell.colorView.frame.height / 2 + cell.colorView.layer.borderWidth = 0.4 + cell.colorView.layer.borderColor = #colorLiteral(red: 0.2549019754, green: 0.2745098174, blue: 0.3019607961, alpha: 1) cell.colorView.backgroundColor = self.df.getColourPalette()[prefs.integer(forKey: "colour-index-\(courses[indexPath.item])")] cell.backgroundColor = #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) return cell diff --git a/AvH Plan/DataFetcher.swift b/AvH Plan/DataFetcher.swift index 6d02908..0e463a4 100644 --- a/AvH Plan/DataFetcher.swift +++ b/AvH Plan/DataFetcher.swift @@ -279,7 +279,7 @@ class DataFetcher { } func getColourPaletteNames() -> [String] { - return ["White", "Red", "Orange", "Yellow", "Green", "Cyan", "Light Blue", "Blue", "Purple", "Pink", "Brown", "Grey"] + return [NSLocalizedString("white", comment: ""), NSLocalizedString("red", comment: ""), NSLocalizedString("orange", comment: ""), NSLocalizedString("yellow", comment: ""), NSLocalizedString("green", comment: ""), NSLocalizedString("cyan", comment: ""), NSLocalizedString("lightblue", comment: ""), NSLocalizedString("blue", comment: ""), NSLocalizedString("purple", comment: ""), NSLocalizedString("pink", comment: ""), NSLocalizedString("brown", comment: ""), NSLocalizedString("grey", comment: "")] } func getColour(for course: String) -> UIColor { @@ -337,4 +337,8 @@ class DataFetcher { return #colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) } } + + let courses = ["German", "English", "French", "Spanish", "Latin", "Turkish", "Chinese", "Arts", "Music", "Theatre", "Geography", "History", "Politics", "Philosophy", "Religion", "Maths", "Biology", "Chemistry", "Physics", "CompSci", "PhysEd", "GLL", "WAT", "Forder", "WP"] + + let translatedCourses = [NSLocalizedString("german", comment: ""), NSLocalizedString("english", comment: ""), NSLocalizedString("french", comment: ""), NSLocalizedString("spanish", comment: ""), NSLocalizedString("latin", comment: ""), NSLocalizedString("turkish", comment: ""), NSLocalizedString("chinese", comment: ""), NSLocalizedString("arts", comment: ""), NSLocalizedString("music", comment: ""), NSLocalizedString("theatre", comment: ""), NSLocalizedString("geography", comment: ""), NSLocalizedString("history", comment: ""), NSLocalizedString("politics", comment: ""), NSLocalizedString("philosophy", comment: ""), NSLocalizedString("religion", comment: ""), NSLocalizedString("mathematics", comment: ""), NSLocalizedString("biology", comment: ""), NSLocalizedString("chemistry", comment: ""), NSLocalizedString("physics", comment: ""), NSLocalizedString("compsci", comment: ""), NSLocalizedString("physed", comment: ""), NSLocalizedString("gll", comment: ""), NSLocalizedString("wat", comment: ""), NSLocalizedString("forder", comment: ""), NSLocalizedString("wp", comment: "")] } diff --git a/AvH Plan/de.lproj/Main.strings b/AvH Plan/de.lproj/Main.strings new file mode 100644 index 0000000..4185842 --- /dev/null +++ b/AvH Plan/de.lproj/Main.strings @@ -0,0 +1,80 @@ + +/* Class = "UITabBarController"; title = "AvH Plan"; ObjectID = "49e-Tb-3d3"; */ +"49e-Tb-3d3.title" = "AvH-Plan"; + +/* Class = "UITextField"; accessibilityHint = "Courses"; ObjectID = "69O-Fo-TQF"; */ +"69O-Fo-TQF.accessibilityHint" = "Kurse"; + +/* Class = "UITextField"; placeholder = "Your courses"; ObjectID = "69O-Fo-TQF"; */ +"69O-Fo-TQF.placeholder" = "Deine Kurse"; + +/* Class = "UILabel"; text = "Label"; ObjectID = "6H8-lj-boN"; */ +"6H8-lj-boN.text" = "Label"; + +/* Class = "UINavigationItem"; title = "Personal Plan"; ObjectID = "8j4-CR-EDO"; */ +"8j4-CR-EDO.title" = "Persönlicher Plan"; + +/* Class = "UINavigationItem"; title = "Customize"; ObjectID = "9Pf-pB-wLS"; */ +"9Pf-pB-wLS.title" = "Anpassen"; + +/* Class = "UINavigationItem"; title = "Information"; ObjectID = "9lv-eD-jS6"; */ +"9lv-eD-jS6.title" = "Informationen"; + +/* Class = "UIViewController"; title = "AvH Plan"; ObjectID = "9pv-A4-QxB"; */ +"9pv-A4-QxB.title" = "AvH-Plan"; + +/* Class = "UITabBarItem"; title = "Information"; ObjectID = "BQ7-VO-yI4"; */ +"BQ7-VO-yI4.title" = "Informationen"; + +/* Class = "UINavigationItem"; title = "Title"; ObjectID = "HYG-gj-KYl"; */ +"HYG-gj-KYl.title" = "Title"; + +/* Class = "UITabBarItem"; title = "Menu"; ObjectID = "IfX-2p-YWq"; */ +"IfX-2p-YWq.title" = "Speiseplan"; + +/* Class = "UIBarButtonItem"; title = "Done"; ObjectID = "PWA-cp-z6o"; */ +"PWA-cp-z6o.title" = "Speichern"; + +/* Class = "UITextField"; accessibilityHint = "Name"; ObjectID = "TpM-Mz-EpI"; */ +"TpM-Mz-EpI.accessibilityHint" = "Name"; + +/* Class = "UITextField"; placeholder = "Your name"; ObjectID = "TpM-Mz-EpI"; */ +"TpM-Mz-EpI.placeholder" = "Dein Name"; + +/* Class = "UIBarButtonItem"; title = "Done"; ObjectID = "ZI8-Ec-yYU"; */ +"ZI8-Ec-yYU.title" = "Speichern"; + +/* Class = "UITabBarItem"; title = "Plan"; ObjectID = "acW-dT-cKf"; */ +"acW-dT-cKf.title" = "Plan"; + +/* Class = "UINavigationItem"; title = "AvH Plan"; ObjectID = "b1q-oE-Z8h"; */ +"b1q-oE-Z8h.title" = "AvH-Plan"; + +/* Class = "UITextField"; accessibilityHint = "Classes"; ObjectID = "bCV-w1-hVY"; */ +"bCV-w1-hVY.accessibilityHint" = "Klassen"; + +/* Class = "UITextField"; placeholder = "Your classes"; ObjectID = "bCV-w1-hVY"; */ +"bCV-w1-hVY.placeholder" = "Deine Klassen"; + +/* Class = "UITabBarItem"; title = "Personal"; ObjectID = "cPa-gy-q4n"; */ +"cPa-gy-q4n.title" = "Persönlich"; + +/* Class = "UILabel"; text = "Default plan"; ObjectID = "hkV-XP-jXe"; */ +"hkV-XP-jXe.text" = "Standardplan"; + +/* Class = "UIBarButtonItem"; title = "Customize"; ObjectID = "iH8-LX-SKF"; */ +"iH8-LX-SKF.title" = "Anpassen"; + +"meV-sG-wBX.title" = "Anpassen"; + +/* Class = "UINavigationItem"; title = "Food Menu"; ObjectID = "mFX-6q-tAs"; */ +"mFX-6q-tAs.title" = "Speiseplan"; + +/* Class = "UISegmentedControl"; omP-RH-Hlh.segmentTitles[0] = "General"; ObjectID = "omP-RH-Hlh"; */ +"omP-RH-Hlh.segmentTitles[0]" = "Allgemein"; + +/* Class = "UISegmentedControl"; omP-RH-Hlh.segmentTitles[1] = "Personal"; ObjectID = "omP-RH-Hlh"; */ +"omP-RH-Hlh.segmentTitles[1]" = "Persönlich"; + +/* Class = "UILabel"; text = "Custom colours"; ObjectID = "rks-gf-AM4"; */ +"rks-gf-AM4.text" = "Benutzerdefinierte Farben";