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/trunk@21142 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21143 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
GrampsLocale: Remove ggettext

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

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/trunk@21145 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21146 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
[Bug 6364] Fix file-opening failures due to unicode content.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/trunk@21147 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21148 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21149 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21150 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21151 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21152 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21153 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
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/trunk@21154 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
Use IMAGE_DIR in geography.py so that map images can be found when running from source directory.

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/trunk@21155 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
Descendant Report:  Fix changed Sort function name

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/trunk@21156 4ae1f11a-8b86-4847-b8af-ab372f36d1fd
Fix GeoGraphyView.__init__ arg list for simplified bookmarks

git-svn-id: svn+ssh://svn.code.sf.net/p/gramps/code/trunk@21157 4ae1f11a-8b86-4847-b8af-ab372f36d1fd