2017-09-26 2 views
0

J'ai un problème après avoir migré vers iOS 11 et la version de Xcode est passée à 9.
Lorsque je choisis la langue "birmane", le texte du menu "Réglage" ne traduit pas mais le les textes des menus de repos sont traduits en langue birmane.
Localisation dans iOS 11, swift 4

var TableArray = [["Home","Buy", "Watch Later"],["Notification","Settings","User Guide"]] 

textes du menu rangèrent et qui localise dans la cellule du tableau d'affichage.

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 

    let cell = tableView.dequeueReusableCell(withIdentifier: TableArray[indexPath.section][indexPath.row], for: indexPath) as UITableViewCell 
    cell.imageView?.image = menuIconImage[indexPath.section][indexPath.row] 
    cell.textLabel?.text = NSLocalizedString(TableArray[indexPath.section][indexPath.row], comment: "") 
    cell.textLabel?.font = UIFont(name: "Tharlon", size: 17) 
    cell.selectionStyle = UITableViewCellSelectionStyle.blue 
    tableView.rowHeight = 56.0; 

    return cell 

} 

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { 
    prefs.setValue(false, forKey: "FLAG") 
    prefs.setValue(true, forKey: "DRAWER") 
    debugPrint("Click LogIn") 

    let cell = tableView.dequeueReusableCell(withIdentifier: TableArray[indexPath.section][indexPath.row], for: indexPath) as UITableViewCell 
    cell.imageView?.image = menuIconImage[indexPath.section][indexPath.row] 

    cell.textLabel?.font = UIFont(name: "Tharlon", size: 17) 

    cell.textLabel?.text = NSLocalizedString(TableArray[indexPath.section][indexPath.row], comment: "") 
} 

Cependant j'ai essayé, tous les textes sont changés en « birman », sauf « Paramètres » texte. Donc, j'ajoute à nouveau les codes suivants à l'intérieur de la fonction table, mais cela ne fonctionne pas.

if (cell.textLabel?.text == "Settings") { 
     cell.textLabel?.text = NSLocalizedString(TableArray[indexPath.section][indexPath.row], comment: "") 
     cell.textLabel?.font = UIFont(name: "Tharlon", size: 17) 
    } 


Quelqu'un peut-il me aider s'il vous plaît? Je trouve toujours une solution pour cela depuis 2 jours. :(

Répondre

0
if Language.currentLanguage() == "ar" 
{ 
    cell.textLabel?.textAlignment = .right 
} 
else 
{ 
    cell.textLabel?.textAlignment = .left 
} 

cela a fonctionné avec moi