allenlinli
allenlinli

Reputation: 2154

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:

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 ?

Upvotes: 7

Views: 322

Answers (3)

Greg Robertson
Greg Robertson

Reputation: 2347

Have you tried overriding the title?

override func awake(withContext context: Any?)
{
    self.setTitle("Cancel")       
    super.awake(withContext: context)
}

override func willActivate()
{
    self.setTitle("Cancel")
}

Upvotes: 0

Greg Robertson
Greg Robertson

Reputation: 2347

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))

Upvotes: 1

ChaosCoder
ChaosCoder

Reputation: 3255

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)

Upvotes: 1

Related Questions