From 853e2d5adf924876f7e0dfb1d7eff0aa26455bf8 Mon Sep 17 00:00:00 2001
From: Mustafa Merza <mustafa.merza95@gmail.com>
Date: Thu, 18 Jul 2024 09:28:50 +0300
Subject: [PATCH] - Added using localized strings for some views.

---
 .../Extensions/String+StringKeys.swift        |   8 ++
 .../AllFolderTableViewCell.swift              |   8 ++
 .../AllFolderTableViewCell.xib                |   5 +-
 .../CustomTabBarView/CustomTabBarView.swift   |   4 +-
 .../KNAlert/KNAlertViewController.swift       |   2 +
 .../SearchFilesView/SearchFilesView.swift     |   2 +-
 .../DocumentsTableViewController.swift        |   4 +-
 .../Localization/Localizable.xcstrings        | 119 ++++++++++++++++++
 8 files changed, 145 insertions(+), 7 deletions(-)

diff --git a/MiniScanner/Extensions/String+StringKeys.swift b/MiniScanner/Extensions/String+StringKeys.swift
index 131dbc0..9c56420 100644
--- a/MiniScanner/Extensions/String+StringKeys.swift
+++ b/MiniScanner/Extensions/String+StringKeys.swift
@@ -52,4 +52,12 @@ extension String {
     
     static let yes = "yes"
     static let no = "no"
+    
+    static let fileManager =  "file_manager"
+    static let folders =  "folders"
+    static let folderFiles =  "folder_files"
+    static let noFilesToShow =  "no_files_to_show"
+    static let folderName = "folder_name"
+    static let preview =  "preview"
+    static let done =  "done"
 }
diff --git a/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift b/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift
index 6437460..77388e4 100644
--- a/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift
+++ b/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.swift
@@ -18,6 +18,7 @@ final class AllFolderTableViewCell: UIView {
     @IBOutlet private weak var view: UIView!
     @IBOutlet weak var collectionView: UICollectionView!
     @IBOutlet weak var addFolderButton: UIButton!
+    @IBOutlet weak var foldersLabel: UILabel!
     
     // MARK: - Properties
     var folders: [AppConfigurator.Folder] = []
@@ -34,6 +35,13 @@ final class AllFolderTableViewCell: UIView {
         super.init(coder: aDecoder)
         
         setupNib()
+        setupUI()
+    }
+    
+    private func setupUI() {
+        addFolderButton.set(localized: .addFolder)
+        
+        foldersLabel.set(localized: .folders)
     }
     
     private func setupNib() {
diff --git a/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.xib b/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.xib
index 9094736..e35c3e3 100644
--- a/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.xib
+++ b/MiniScanner/Modules/Documents/Customs/CustomViews/AllFolderTableView/AllFolderTableViewCell.xib
@@ -1,9 +1,9 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="22155" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
     <device id="retina6_12" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22131"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="22685"/>
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="System colors in document resources" minToolsVersion="11.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
@@ -13,6 +13,7 @@
             <connections>
                 <outlet property="addFolderButton" destination="RpH-94-tHk" id="EvT-GP-STM"/>
                 <outlet property="collectionView" destination="ATv-Qf-nQ6" id="tpu-Qf-4th"/>
+                <outlet property="foldersLabel" destination="k4D-XM-uc5" id="rjr-lJ-sap"/>
                 <outlet property="view" destination="IMm-Qg-H9R" id="eqa-cf-UOK"/>
             </connections>
         </placeholder>
diff --git a/MiniScanner/Modules/Documents/Customs/CustomViews/CustomTabBarView/CustomTabBarView.swift b/MiniScanner/Modules/Documents/Customs/CustomViews/CustomTabBarView/CustomTabBarView.swift
index f306ce9..df78b9d 100644
--- a/MiniScanner/Modules/Documents/Customs/CustomViews/CustomTabBarView/CustomTabBarView.swift
+++ b/MiniScanner/Modules/Documents/Customs/CustomViews/CustomTabBarView/CustomTabBarView.swift
@@ -61,7 +61,7 @@ class CustomTabBarView: UIView {
     
     private func setupUI() {
         editImageIcon.image = UIImage(named: "preview")
-        editImageLabel.set(text: "Preview", color: .white, font: .medium(18))
+        editImageLabel.set(text: .preview.localized, color: .white, font: .medium(18))
         editImageView.layer.cornerRadius = 10
         editImageView.backgroundColor = .buttonsBlue
         badgeView.layer.cornerRadius = 10
@@ -91,7 +91,7 @@ class CustomTabBarView: UIView {
             
             if isAddedToPDF {
                 editImageIcon.image = nil
-                editImageLabel.set(text: "Done")
+                editImageLabel.set(text: .done.localized)
                 editImageLabel.textAlignment = .center
                 editImage_width.constant = 0
                 editImage_trailing.constant = 0
diff --git a/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift b/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift
index f13386d..92e2132 100644
--- a/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift
+++ b/MiniScanner/Modules/Documents/Customs/CustomViews/KNAlert/KNAlertViewController.swift
@@ -149,6 +149,8 @@ extension KNAlertViewController {
         
         buttonsView_height.constant = 0
         
+        folderName.placeholder = .folderFiles.localized
+        
         folderName.addTarget(self, action: #selector(textChanged), for: .editingChanged)
         confirmationButton.isEnabled = folderName.text != "" ? true : false
     }
diff --git a/MiniScanner/Modules/Documents/Customs/CustomViews/SearchFilesView/SearchFilesView.swift b/MiniScanner/Modules/Documents/Customs/CustomViews/SearchFilesView/SearchFilesView.swift
index 4be47b2..3fcf267 100644
--- a/MiniScanner/Modules/Documents/Customs/CustomViews/SearchFilesView/SearchFilesView.swift
+++ b/MiniScanner/Modules/Documents/Customs/CustomViews/SearchFilesView/SearchFilesView.swift
@@ -66,7 +66,7 @@ final class SearchFilesView: UIView {
     
     private func setupUI() {
         boxView.layer.cornerRadius = 30
-        titleLabel.set(text: "Folder files", color: .titlesText, font: .bold(20))
+        titleLabel.set(text: .folderFiles.localized, color: .titlesText, font: .bold(20))
         searchTextField.isHidden = true
         searchTextField.addTarget(self, action: #selector(textFieldDidChange), for: .editingChanged)
         searchTextField.delegate = self
diff --git a/MiniScanner/Modules/Documents/DocumentsTableViewController.swift b/MiniScanner/Modules/Documents/DocumentsTableViewController.swift
index 9fd9523..89b1ce0 100644
--- a/MiniScanner/Modules/Documents/DocumentsTableViewController.swift
+++ b/MiniScanner/Modules/Documents/DocumentsTableViewController.swift
@@ -63,7 +63,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate,
         }
         scanSession =  MultiPageScanSession()
         options = ImageScannerOptions()
-        navigationItem.title = "File Manager"
+        navigationItem.title = .fileManager.localized
         let settingsButton = UIBarButtonItem(image: UIImage(named: "settings"), style: .done, target: self, action: #selector(openSettings))
         navigationItem.rightBarButtonItem = settingsButton
         
@@ -109,7 +109,7 @@ final class DocumentsTableViewController: UIViewController, UITableViewDelegate,
         fixedTableSheet.layer.shadowRadius = 4.0
         fixedTableSheet.backgroundColor = .white // or any non-clear color
         fixedTableSheet.clipsToBounds = false
-        noFilesLabel.set(text: "No Files to show", color: .mainText, font: .medium(22))
+        noFilesLabel.set(text: .noFilesToShow.localized, color: .mainText, font: .medium(22))
         noFilesLabel.isHidden = true
         fetchViewModels()
         
diff --git a/MiniScanner/Supporting Files/Localization/Localizable.xcstrings b/MiniScanner/Supporting Files/Localization/Localizable.xcstrings
index e238b6c..70deb08 100644
--- a/MiniScanner/Supporting Files/Localization/Localizable.xcstrings	
+++ b/MiniScanner/Supporting Files/Localization/Localizable.xcstrings	
@@ -188,6 +188,23 @@
         }
       }
     },
+    "done" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "ar" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "تم"
+          }
+        },
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Done"
+          }
+        }
+      }
+    },
     "entire_document" : {
       "extractionState" : "manual",
       "localizations" : {
@@ -205,6 +222,23 @@
         }
       }
     },
+    "file_manager" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "ar" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "مدير الملفات"
+          }
+        },
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "File Manager"
+          }
+        }
+      }
+    },
     "file_name" : {
       "extractionState" : "manual",
       "localizations" : {
@@ -222,6 +256,57 @@
         }
       }
     },
+    "folder_files" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "ar" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "ملفات المجلد"
+          }
+        },
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Folder files"
+          }
+        }
+      }
+    },
+    "folder_name" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "ar" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "اسم المجلد"
+          }
+        },
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Folder name"
+          }
+        }
+      }
+    },
+    "folders" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "ar" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "المجلدات"
+          }
+        },
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Folders"
+          }
+        }
+      }
+    },
     "gallery" : {
       "extractionState" : "manual",
       "localizations" : {
@@ -301,6 +386,40 @@
         }
       }
     },
+    "no_files_to_show" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "ar" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "لا يوجد ملفات للعرض"
+          }
+        },
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "No Files to show"
+          }
+        }
+      }
+    },
+    "preview" : {
+      "extractionState" : "manual",
+      "localizations" : {
+        "ar" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "معاينة"
+          }
+        },
+        "en" : {
+          "stringUnit" : {
+            "state" : "translated",
+            "value" : "Preview"
+          }
+        }
+      }
+    },
     "print" : {
       "extractionState" : "manual",
       "localizations" : {
-- 
GitLab