Bug 60308 - UIBarButtonSystemItem.Done always english
Summary: UIBarButtonSystemItem.Done always english
Status: RESOLVED ANSWERED
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: XI 11.4 (d15-5)
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-10-22 00:28 UTC by Sebastian Kruse
Modified: 2017-11-28 21:05 UTC (History)
3 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED ANSWERED

Description Sebastian Kruse 2017-10-22 00:28:30 UTC
I try to add a "Done"-Button to the keyboard with this line of code: 

new UIBarButtonItem(UIBarButtonSystemItem.Done, delegate { Control.ResignFirstResponder(); })

The button appears and work correctly but the text "Done" always stays english. Even on a german device where other apps has the string "Fertig".
Comment 1 Timothy Risi 2017-10-23 17:24:37 UTC
I created an Xcode project and added a UIBarButton in the same way (using UIBarButtonSystemItemDone) and ran it in the simulator, then changed the simulator language to German.  After relaunching the app with the simulator in German, I saw the same result there, the text "Done" was still in english, so it looks like this is the native behavior from Apple
Comment 2 Sebastian Kruse 2017-10-23 19:06:42 UTC
No it's not from Apple. If I use the Swift alternative it translates correctly.
Comment 3 Timothy Risi 2017-10-23 19:21:13 UTC
Can you provide a swift sample that works correctly?  I created a new swift project in Xcode and added the button with:

 let addButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(insertNewObject(_:)))
        navigationItem.rightBarButtonItem = addButton

I changed the language on my phone to German, then ran the sample on device, and it still shows "Done" in English.
Comment 4 Sebastian Kruse 2017-10-23 19:23:24 UTC
hmm my code looks pretty similar but it works (but I debug on a real device, maybe there is a difference). I can also verify that other apps change the "Done" label to the selected language.
Comment 5 Timothy Risi 2017-10-23 19:26:14 UTC
My swift sample was run on device as well
Comment 6 Vincent Dondain [MSFT] 2017-11-28 21:05:24 UTC
@sebastian, your app needs to be localized for iOS to translate its system buttons. Otherwise everything stays in English which is the default development language.

E.g:

If you create a new project > Master-Detail App template (it has system edit/done buttons so it's easy to test), deploy to the simulator and change the language of the simulator to anything other than English, the system buttons are not translated.

However if you follow these steps to enable localization: https://developer.xamarin.com/guides/ios/advanced_topics/localization_and_internationalization/#Localization_Basics_in_iOS

In my case I did:

Open Info.plist > Go to Source > Add new entry > Localization and added the value "fr".

My Info.plist now has:

<key>CFBundleLocalizations</key>
<array>
  <string>fr</string>
</array>

Now if the simulator is in French, the app, which is now localized (only to French) will display its system buttons in French (:

I hope this helps.