Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Default Date picker localization #6648


User avatar
0
yyfiremaple created

Hi there,

Is there a way to localize the default date picker? Adding entries into the localizationDictionary of desired language won't work.

Thanks.


5 Answer(s)
  • User Avatar
    0
    ryancyq created
    Support Team

    Hi,

    • What is your product version?
    • What is your product type (Angular or MVC)?
    • What is product framework type (.net framework or .net core)?
  • User Avatar
    0
    yyfiremaple created

    <span class="colour" style="color: rgb(0, 0, 0);">Hi,</span>

    In using version 6.7.0 .Net core MVC.

    Thanks

  • User Avatar
    0
    ryancyq created
    Support Team

    Hi, if you only want to change the language for a datetimepicker. You use the approach here.

    See https://github.com/aspnetzero/aspnet-zero-core/blob/f72d4bf9ced778e06265f1c415a8553b10cbaf3d/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Mvc/wwwroot/view-resources/Areas/AppAreaName/Views/Tenants/_CreateModal.js#L59-L62

    However, if you want to customize the text for a certain language, you will need to overrides datetimepicker.tooltips similar to how default icons being overriden.

    see https://github.com/aspnetzero/aspnet-zero-core/blob/8f3ed20ca0eafeeb664e7ed59deee0404739d2a4/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Mvc/wwwroot/assets/bootstrap4-datetimepicker/defaults.js#L1

    The list of texts that can be overriden can be found at

    https://github.com/wgbbiao/bootstrap4-datetimepicker/blob/f4edfa96efd8a9aec0567dc2c42369346d24cd40/src/js/bootstrap-datetimepicker.js#L2473-L2499

  • User Avatar
    0
    yyfiremaple created

    Hi ryancyq,

    Thanks for the reply, I just want to change the language for the datetimepicker. I looked at the link you provided, but I still counldn't figuare out how to make it work.

    If I want to change it to ru, do I need to download bootstrap-datepicker.ru.min.js? could you provide more detail of how to achieve this please.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    @yyfiremaple

    No, you just need to add something like below;

    $.fn.datetimepicker.defaults.tooltips = {
         today: 'Go to today',
    	 ...
    	 ...
    	 ...
    };