Splits out Win32 and Posix initializations to take account of the
fact that on Win32 setlocale() ignores environment variables and on
Posix it's not necessary to check them because setlocale() does the
right thing.
svn: r21830
Replace stdout with one that uses a transcoding Streamwriter. This
better handles differences between Py2 and Py3 than does trying to
encode strings prior to output. In particular Py3's default stdout
demands unencoded strings and prints byte-strings when one tries to
pre-encode them.
svn: r21695
Lets one import grampslocale directly in a test script:
>>> from gramps.gen.utils.grampslocale import GrampsLocale
>>> import os
>>> gl = GrampsLocale(lang='fr_FR.UTF-8', localedir=os.path.join('build', 'mo'))
>>> tr = gl.get_translation().gettext
>>> tr("List of known family trees in your database path\n")
u'Liste des arbres familiaux connus dans votre chemin de base de donn\xe9es\n'
svn: r21640
Uses GRAMPS_RESOURCES to override the root location of the Gramps data files (which would normally be $(prefix)/share).
In setup.py install, writes $(prefix)/share to gen/utils/resource-path, installs that file, then deletes it again from the source tree. The presence or absence determines whether Gramps is running from the source directory or from an installation.
Const.py is now a static file; const.py.in is no longer used. Note that because importing const into setup tried to initialize things that we don't want initialized, VERSION is removed, and imported from gramps.version -- a file which will be added in the next change. Consequently, this commit will not run.
svn: r21613
Make sure that lang overrides the language list only if $LANG is set. Don't add encodings to the language list (e.g., en_US, not en_US.UTF-8). Start collation with None, because `if collation:` is True for collation = "". defaults may have whitespace at the end of "root", so use "startswith".
svn: r21596
Replace "en" with "C" when setting $LANGUAGE ("en" confuses GtkBuilder), and explicitly iterate over languages when finding
the translator, because left to itself gettext will ignore English.
svn: r21595
Apparently some Linuxes require it for GtkBuilder to find the localization files. It's not supported on Win32, though, so don't try in that case.
svn: r21488
Test only first 5 or first 2 characters of the language id against the
list of available translations.
Thanks to Tim Lyons for exposing the error.
svn: r21326
With GrampsLocale.sort_key (for strxfrm and conv*_tosrtkey) and
GrampsLocale.strcoll.
If ICU is available will use the correct ICU::Collator for the locale,
otherwise falls back to locale.strxfrm -- for which it temporarily
changes the LC_COLLATE locale.
svn: r21275
Permits sorting by localized language name.
Also hides the language code, which the user doesn't really care about.
Removes get_language_string from libtranslate.py, no longer needed.
svn: r21236
Only the first dependent upon the environment
All may be created with parameters which override environment variables or OS settings.
See the GrampsLocale docstring for details.
svn: r21182
Making use of the fact that GrampsLocale now knows what
encoding to use, and noting that filesystems don't use
more than one encoding to write filenames in directories.
Also specify the encoding on some more files
svn: r21148
On MSWin and OSX, this call always returns the correct
value (utf-8 on OSX, 'mbcs' on MSWin), but on Linux the
return value is bizarrely dependent upon the environment.
Replace it with a GrampsLocale function which returns 'utf-8'
(the correct value for most Linux file systems) regardless of
the environment.
Also replace its use in print and write functions: It's the
encoding of paths in the filesystem, not of the files's content,
nor of the terminal's capabilities. The former is almost
always utf-8 as long as we write the file, the latter is
given by sys.stdout.encoding. Use the 'backslashreplace' error
handler to avoid exceptions when we need to output unicode
text to an ASCII terminal.
svn: r21146
GrampsLocale is effectively a singleton: An instance is created in
const.py and retrieved everywhere.
Translations are provided via Translations classes, which are derived
from GNUTranslations and NullTranslations to provide extra functions
like sgettext.
svn: r21143
Reflecting discussion on gramps-devel about their affecting more than
just translations.
Provide for a master GrampsLocale instance to be retrieved from
const.py, set by grampsapp.
svn: r21142
1) add SVN svn:keywords "Id" property if it didn't have it
2) add SVN svn:mime-type "text/plain" property if it didn't have it
3) add SVN "Id" line to the file if it had none
4) reformat SVN "Id" line in the file if it needed it
svn: r20708
round 2 for python 3 support:
* no more cmp, also not in sort and sorted
* bsddb needs bytestring keys
* gtk does not need utf-8 encoded anymore...
svn: r20658
This does patch updates Gramps to the 3.2 syntax, it does not yet mean Gramps works with python 3.2
Expect next day commits to fix further issues, but this is the main 2to3 tool created patch changed
where needed to have python 2.7 work.
Specific issues might be:
1. next has been changed, must be checked
2. new division as on the wiki page listed is to do
3. ...
svn: r20634