Nativescript: iOS Datepicker month not localized

Created on 14 Nov 2017  路  6Comments  路  Source: NativeScript/NativeScript

On iOS the month name in datepicker is not localized to the language/region settings on the phone.

Which platform(s) does your issue occur on?

iOS

Please provide the following version numbers that your issue occurs with:

  • CLI: 3.3.0
  • Cross-platform modules: 3.3.0
  • Runtime(s): 3.3.0

Please tell us how to recreate the issue in as much detail as possible.

Set phone or simulator language and region to anything other than english.
Create a new project, insert a Datepicker on a page and run.

In my case I have set the phones language to Danish and region to Denmark, but the month name is still shown in english.
Is this as expected? If so have do I set the locale to use for the datepicker?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

backlog bug good first issue hacktoberfest help wanted ios medium

All 6 comments

Hi @gregersen79,
Thank you for your interest in NativeScript.
On iOS, you should also set up the CFBundleLocalizations key in your Info.plist. This key describes the languages, which could be used from the application. For example:

Info.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    ...........
    <key>CFBundleLocalizations</key>
    <array>
        <string>da</string>
    </array>
</dict>
</plist>

A list with the language-designators could be found here.
Let me know if you were able to resolve your problem.

Hi @tsonevn,
Thanks, your solution works.
But do you know if the CFBundleLocalizations key is necessary to add because I upgraded to Xcode 9? Because before I upgraded to Xcode 9, the month name was shown in the correct locale, but after upgrading to Xcode 9 I have to add this key.
It just have me puzzled why I need to add this key all of a sudden.

Hi @gregersen79,
In our further research, we found that this is not related to the Xcode version.
The datepicker will not be localized automatically only on iOS 11.
We will investigate further this issue and will provide more info when we find, what is causing this problem.

News about this 'bug' ?

Hi @realtebo,
This issue is still under review. Also, any PR that fixes this problem will be highly appreciated. Check out Interested in Contributing to the Codebase? section of the README file

I've implemented the test example on iOS (https://github.com/SergeyMell/_date_picker_localization_issue). And it seems this issue is iOS relate, not NativeScript. As s possible solution I can provide options for manual localization of date picker days and months. Would this solution be an appropriate one?

Was this page helpful?
0 / 5 - 0 ratings