[r21142]Rename trans.py and mactrans.py to grampslocale.py and
maclocale.py

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.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21390 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21143]Localization: Re-implement localization as a class, GrampsLocale

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.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21391 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21144]GrampsLocale: Remove ggettext

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21392 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21145][Bug 6222]: Get the addons language list from the primary
GrampsLocale instance.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21393 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21146]GrampsLocale: Replace calls to sys.getfilesystemencoding

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.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21394 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21147][Bug 6364] Fix file-opening failures due to unicode content.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21395 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21148]GrampsLocale: Simplify the file-finding functions

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

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21396 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21149]Fix some file resource leaks

I.e., files left open when the opening function exits. This is
a PyDebug warning.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21397 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21150]GrampsLocale: Use the codeset from the singleton translation

Instead of locale.getlocale() or locale.nl_langinfo

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21398 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21151]GrampsLocale: Get the language code from the global translation

Instead of probing locale.getlocale() and environment variables

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21399 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21152]GrampsLocale: Fix file encoding error in recentfiles

Expat wants a binary file, not a string file.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21400 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21153]PdfDocGen: Report cause of failure on all exceptions

not just file open ones. Expat can raise exceptions too!

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21401 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21154]Import get_svn_revision into const.py

via const.py.in, of course

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21402 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21156]Descendant Report:  Fix changed Sort function name

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21403 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21168]GrampsLocale: get_relationship_calculator: Fix missed variable
name change.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21404 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21170]GrampsLocale: Convert some late-added translations to
GRAMPS_LOCALE

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21405 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21179]Fix undefined variable reference, make separate not-loaded
warning

Thanks to Pat Lefebre for reporting the error.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21406 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21180]Fix platform detection on OSX

'darwin' is returned by sys.platform, not os.name.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21407 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21181]relationship.py: Remove unused import

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21408 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[r21182]GrampsLocale: Restructure so for multiple GrampsLocale objects

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.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/branches/maintenance/gramps40@21409 4ae1f11a-8b86-4847-b8af-ab372f36d1fd