Alir3z4 / html2text

Convert HTML to Markdown-formatted text.
alir3z4.github.io/html2text/
GNU General Public License v3.0
1.85k stars 283 forks source link

i18n #15

Open Alir3z4 opened 10 years ago

Alir3z4 commented 10 years ago

Since not all of the world is speaking English, having i18n (or as @svetlemodry said internationalization) would be really good.

Right now, https://github.com/Alir3z4/html2text/blob/master/html2text/cli.py is the only place to start working on its translation.

Python itself is great with gettext and handling translations, the only thing that remains is how to run the app in the specific translation.

For example how to keep track of the selected translation would be keeping the configuration via:

  1. ~/.config/html2text
  2. Pass to ENV var
  3. Pass the translation on runtime to CLI

So let's talk about those options:

  1. Having app conf under ~/.config/html2text is something standard in GNU/Linux and *unix based machines. In future with regards of the progress of the CLI we can easily expand and use that configuration file. This option makes CLI slower on load time, since it should read a file from user conf dir.
  2. ENV is a good place if we're not going to keep lots of conf file and an env var such as HTML2TEXT_LANG=miow can be enough and we're good to go. it can be easily picked up while running the program.
  3. I'm not a fan on these, no never! Program should know the translation without explicitly declaring the language.
theSage21 commented 8 years ago

What is meant by i18n?

svetlemodry commented 8 years ago

Usualy it's the abreviation for internationalization.

theSage21 commented 8 years ago

Ok. What would it mean in this context?

Alir3z4 commented 8 years ago

@theSage21 @svetlemodry Just updated the issue description about it. Thanks for your consideration and I'm sorry for not writing any description earlier.

JokerQyou commented 7 years ago

I don't quite understand why i18n matters for a cli tool, but if you're going to implement it, wouldn't it be enough to just read from LANG / LANGUAGE / LC_CTYPE environment variables?

Alir3z4 commented 7 years ago

@JokerQyou the CLI help and description in the source code are all written in English. Would be fine if the CLI was in Arabic or Spanish and English speaking people wanted to use it ? I don't think so. The same goes for non-english speaking people.