Re: gettext and windows
"Martin v. Loewis" <[email protected]>
| Newsgroups | gmane.comp.python.internationalization |
|---|---|
| Message-ID | <[email protected]> |
> I have a patch which uses locale.getdefaultlocale()[0] to get information, > but I wanted to know if there was a reason why this had not been used in > the first place. gettext.find uses the GNU gettext strategy for locating catalogs. I think there should be a routine that models GNU gettext as close as possible, even on Windows - Windows also supports environment variables, after all. That routine does not need to be called gettext.find, though. I'd agree that this algorithm is not optimal. However, just considering the default locale is not appropriate, either: - On Windows, there is a user locale and a system locale. I don't know what the change is that they ever differ, but if they do, this might need consideration - Currently, catalogs are located in <sys.prefix>/share/locale/<lang>/LC_MESSAGES. This is appropriate on Unix, since each of the directories on the path will contain a lot of other stuff. It is less appropriate on Windows; we should consider placing the catalogs into a location nearer to the root of the Python installation. - GNU gettext has the feature of fallback languages, e.g. setting LANGUAGES to "fr:es" indicates that you prefer French translations, but if none are available, you'd prefer Spanish ones over the default text (which typically is English). That may be worth being exposed also (*). So there is something to be fixed, but it appears that more is involved than just looking at the default locale. Regards, Martin (*) Of course, the fallback mechanism is not fully implemented in gettext.py, yet: it will fallback on a per-catalog basis, but not on a per-message basis.