Pomax / pomax.github.io

My blog, hosted via github
15 stars 1 forks source link

Localization is hard. #9

Open sney2002 opened 5 years ago

sney2002 commented 5 years ago

Hi Pomax,

I just found your Primer on Bézier and It has help me a lot, Thanks you for such a useful resource.

I was reading about the problems you faced to localize the content, and in the last section you say you still have a problem with the text in the interactive graphics.

Maybe I'm missing something but if I'm reading the content in say japanese, don't I have the font to display text in japanese?, and for the alignment problem maybe you can replace the canvas text with html, if you use an inline element the browser will give you the text dimension.

you can style the element to looks like it is a text drawn in the canvas and maybe a max-width/max-height.

P.S.: sorry about my english.

Pomax commented 5 years ago

The issue isn't "do you have the font", it's twofold:

  1. Graphics (which are bitmap graphics, not html) have text placement that are based on English. There is no guarantee that text in an interactive graphic, which has no "text reflow" or "dynamic resizing", will still fit, and not interfere with the thing the graphic's supposed to show off. But more importantly,
  2. Localizing the source code for all the graphics on the site is a much harder task than setting up a way to localize individual content.[locale].md files. Adding localization the traditional way (only use keys in the source code, and then transform the source so that a key resolves to the correct string given the locale it's generating for) makes things entirely opaque and unintelligible when you try to then read that original source code, so that's not a solution.

But, if you have any ideas on how to make graphics source localisation work, I'm all ears (or, well, eyes I supposed)