Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The label “Cancel” from modal segue in Apple Watch showing wrong text - "abbrechen"

When my WKInterfaceController poped up by pressing a menuItem (which was settup by "self.addMenuItem in mainScreen"), the title on the poped WKInterfaceController shows "abbrechen" instead of "Cancel". Anyone know how to fix it to make it showing "Cancel"? Or like where did I probably make a mistake?

//MainScreen.swift
func setContextItems(directToEnabled: Bool) {
        self.clearAllMenuItems()
        self.addMenuItem(with: WKMenuItemIcon.decline, title: "direct", action: #selector(MainScreen.freePressed))
}

Clues:

  • It happens only on my Apple Watch device (WatchOS 3.1). When it runs on the simulator(Xcode 8.2.1, iPhone 7 plus), it works fine showing "Cancel".
  • My Langauge & Region are both English. "Langauge & Region" in my Watch App and my iPhone setting are both English for language and Australian for region.
  • "abbrechen" is "abort" or "cancel" in German.
  • There's a related question on SO.
  • Maybe I changed some plist setting for langauge somewhere.
  • I searched my project, and I can not find keywords like "german", "abbrechen"
  • I did used "#if (TARGET_OS_IOS || TARGET_IPHONE_SIMULATOR)", but there's nothing related.

I guess I might change a plist somewhere that change the locale/laguage only on the Apple Watch. Or maybe it's a rare WatchOS bug. Anyone saw similar problem before ?

like image 811
allenlinli Avatar asked Jan 04 '17 06:01

allenlinli


2 Answers

Check if you are overriding the language settings when installing over Xcode. This can be done using the scheme editor in Xcode:

  • Click the target in the Run destination menu and choose Edit Scheme.
  • On the right, select Options.
  • Check Application Language setting

scheme editor language settings

More information on Testing Specific Languages and Regions (@developer.apple.com)

like image 138
ChaosCoder Avatar answered Sep 23 '22 12:09

ChaosCoder


I am a bit confused by you code? You are giving it the title 'direct' but expecting a title of 'Cancel'?

Should you not be doing:

    self.clearAllMenuItems()
    self.addMenuItem(withImageNamed: "imageFileForDirectButton", title: "Direct", action: #selector(TheController.menuDirectButtonPressedFunction))
    self.addMenuItem(with: WKMenuItemIcon.decline, title: "Cancel", action: #selector(TheController.menuCancelButtonPressedFunction))
like image 23
Greg Robertson Avatar answered Sep 23 '22 12:09

Greg Robertson