timeline add new locale in PF10

UI Components for JSF
Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

21 Oct 2021, 22:00

Can you paste your LT script here that you are attempting to use so I can try it? I will get back to you with what I find out!

Also I submitted this PR to Vis-Timeline: https://github.com/visjs/vis-timeline/pull/1267
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

prancius
Posts: 21
Joined: 27 Aug 2010, 12:50

21 Oct 2021, 22:18

http://infoside.lt/failai/primefaces/calendar.js

This file i inlude in xhtml via template and i have no problem with calendar translations.

Extender i using like this

Code: Select all

<h:outputScript>
    function timelineExtender() {
       //copy the config options into a variable
       var options = $.extend(true, {}, this.cfg.opts);

var options = 
{
  locales: 
  {
    // create a new locale (text strings should be replaced with localized strings)
    lt: 
    {
      current: 'einamas',
      time: 'laikas',
      deleteSelected: 'Istrinti pasirinkta',
    }
  },

  // use the new locale
  locale: 'lt'
};

       //merge all options into the main timeline options
       $.extend(true, this.cfg.opts, options);
    };
    
    
    
</h:outputScript>

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

21 Oct 2021, 22:54

I see the problem. Let me see if I can get you a fix. Give me one day.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

22 Oct 2021, 01:28

OK your extender is correct. Now add these two scripts in your h:head and make sure they are first.

Code: Select all

<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/moment.min.js"></script>
 <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.1/locale/lt.js"></script>
That adds the Lithuanian Moment.js locale into the context before the Timeline loads. This worked for me!

I also added your localte-lt.js client translation to PrimeFaces core with this PR: https://github.com/primefaces/primefaces/pull/8004

If interested we need a server side translation as well???
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

prancius
Posts: 21
Joined: 27 Aug 2010, 12:50

24 Oct 2021, 19:18

Hello,

Thank you. Anyway i can't make it work.

Do you mean i need somehow to make load moment.min.js and lt.js before loading timeline.js?

Image

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

24 Oct 2021, 20:26

I got it working locally. I will create a small runnable example for you.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

prancius
Posts: 21
Joined: 27 Aug 2010, 12:50

24 Oct 2021, 22:14

Good!

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

25 Oct 2021, 13:34

OK working example: https://github.com/primefaces/primeface ... -950830096

Grab that zip file and unzip it and run "mvn clean jetty:run" and navigate to http://localhost:8080/primefaces-test/test.xhtml
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

prancius
Posts: 21
Joined: 27 Aug 2010, 12:50

25 Oct 2021, 15:00

Hello,

Yes it working now via extender as i understand.

In future release maybe extender not needed to load LT locale?

Thank you!

Melloware
Posts: 3716
Joined: 22 Apr 2013, 15:48

25 Oct 2021, 15:02

So in a future release once Vis Timeline accepts my PR you should just be able to set Locale to "lt" and it should just work. But not until Vis Timeline accepts my PR and cuts a new release.
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub Profile: https://github.com/melloware
PrimeFaces Elite 13.0.0 / PF Extensions 13.0.0
PrimeReact 9.6.1

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 29 guests