Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locale support #21

Closed
Tutuchan opened this issue Dec 29, 2016 · 3 comments
Closed

Locale support #21

Tutuchan opened this issue Dec 29, 2016 · 3 comments

Comments

@Tutuchan
Copy link

Hi Dean and thanks for the great package.

I'd like to use it but with a French locale which is not natively supported by vis.js. It is possible to include moment.js with locales in the page in order to have locale support, which is great.

However, moment needs to be included before vis.js for this to work. So I tried several things:

  1. the easiest is to add moment-with-locales.min.js as the first dependency in timevis.yaml, which is what I've done locally but including a 280KB library for a specific use case seems overkill,
  2. I tried adding the dependency dynamically in timevis.R this way:
if (!is.null(options$locale)) {
    deps <- c(
      deps,
      list(
        htmltools::htmlDependency(
          name = "moment",
          version = "2.17.1",
          src = system.file("htmlwidgets/lib/moment-2.17.1", package = "timevis"),
          script = "moment-with-locales.min.js"
        )
      )
    )
  }

which does not work because these dependencies are included after the ones in the YAML config file

  1. it's the same problem when trying to include it directly in a Shiny app with tags$head(tags$script(src = ...)), it is loaded after all the other dependencies

So do you have any ideas how to proceed from there ? Maybe updating the html_dependency structure from htmltools in order to include an include_before field ?

Thanks,
Pierre

@daattali
Copy link
Owner

daattali commented Dec 30, 2016 via email

@Tutuchan
Copy link
Author

Thanks for your answer Dean, I'll open an issue on the htmlwidgets repo !

@daattali
Copy link
Owner

daattali commented Dec 30, 2016 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants