Skip to content

Localize Tidy in other languages #336

@balthisar

Description

@balthisar

I've posted another branch (https://github.com/htacg/tidy-html5/tree/localize) that offers localization support to libtidy and (of course) command line Tidy. It touches a lot of Tidy source code to get the job done and so I don't want to merge it until we have some user reports. I'd like as many of our current console and libtidy users as possible to try it out, even if you only require the current US English that's used (just to make sure I didn't miss anything).

Of course, if you can write well in another language (or would like a regional variant of English or another language), there's a very high chance that your PR will be accepted.

Console application

The console application will try to guess your current locale and set Tidy's output accordingly, always falling back to its standard US English. On 'nix systems this comes from your $LANG and/or $LC_ALL environment variable.

Of course you can specify the language you want with the -lang xxxx command line option. Please use this as one of the first options because Tidy currently uses first in, first out when reading the arguments.

You can specify POSIX language names ("en_US") or Windows names ("american") in the command line parameter.

LibTidy

Will default to "en" as always. Use Bool tidySetLanguage( ctmbstr languageCode ) to tell LibTidy to output a different language's strings (see tidy.c to see how the console app does it). Look at language.h for more utilities.

Languages

Current the default US English is complete, and I think I've gotten en_UK complete, too. (UK users, tell me, do you like "quotes" or "inverted commas"?)

I've also added default es and es_MX languages, but they're all empty except for a single option description and the Tidy information line (asking for localization help in Spanish).

Localization vs Internationalization

These changes make localization possible, but internally Tidy uses the C locale for everything so it's not possible to offer "full" internationalization. I don't really notice any aspect of Tidy that would benefit from more than string support, as we're not managing currencies, decimal separators, etc. Let me know if this isn't the case.

Right to Left Languages

I currently don't have a solution for this, at least for the console application.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions