Chartbuilder icon indicating copy to clipboard operation
Chartbuilder copied to clipboard

How to localize

Open probus opened this issue 8 years ago • 2 comments

How can I start localizing the new Chartbuilder?

probus avatar Jul 13 '15 07:07 probus

Hmm, Chartbuilder 2 isn't quite set up to swap in another language, but it should be.

As a start (i guess) here's a (likely incomplete) list of places that contain thing that should be able to be localized:

  • Error Messaging in src/js/components/shared/DataInput.jsx
  • All of the headers following a step-number in various files
  • Every place there is a Button rendered in various files
  • Every place there is a labeled dropdown such as in the date format options
  • Sugar.js is already locale aware but I don't think we're currently loading in all locales for performance reasons.
  • Chartbuilder attempts to localize number formats automatically in the SessionStore but the fallback to comma separators and dot decimals should be able to be customized

The locale indicator should ultimately be stored in the SessionStore (Right @nsonnad?)

@probus what do you think would be the best way to go about this?

yanofsky avatar Jul 13 '15 16:07 yanofsky

I've changed most of the styling for my publiciation and to make it work one d/m/y data.

Here are the key minimum things I did:

  1. src/js/util/process-dates.js Line 8: +Date.setLocale('en-AU');

Line 11: "lmdy": function(d) {

  •   return d.format('{M}/{d}/{yy}');
    
  •   return d.format('{M}/{d}/{yyyy}');
    
    },

Line 15: "mmdd": function(d) {

  •   return d.format('{M}/{d}');
    
  •   return d.format('{d}/{M}');
    
  1. Customise font sizes: src/styl/chart-renderer.styl - Change $em_sizes
  2. Import custom fonts: src/styl/fonts.styl
  3. Select custom fonts: src/styl/type.styl
  4. Set new default colours: src/styl/colors.styl

ghost avatar Oct 21 '15 23:10 ghost