Commit Graph

98 Commits

Author SHA1 Message Date
John Ralls
56254d4a14 GrampsLocale: Integrate libtranslate functions into GrampsLocale
And remove libtranslate

svn: r21967
2013-04-12 22:27:54 +00:00
John Ralls
27f667e343 GrampsLocale: Add get_date and get_type functions
To enable GrampsLocale to replace libtranlate.py's Translation
class.

svn: r21965
2013-04-12 22:27:32 +00:00
John Ralls
db66851363 GrampsLocale: Add date_parser and date_displayer properties
svn: r21964
2013-04-12 22:27:23 +00:00
John Ralls
6f078627ca MacLocale: Capture collation qualifications
svn: r21963
2013-04-12 22:27:15 +00:00
John Ralls
2c532baf1c GrampsLocale: Make dictionaries class variables
lang_map and country_map

svn: r21962
2013-04-12 22:27:05 +00:00
John Ralls
a422b30fd6 GrampsLocale: Refactor/clean up initialization
Includes moving encoding to be a class variable.

svn: r21961
2013-04-12 22:26:55 +00:00
John Ralls
01b4b7dc4e GrampsLocale: Ensure self.encoding exists before testing it
svn: r21899
2013-04-05 23:40:55 +00:00
John Ralls
e21ba6c432 GrampsLocale: Clean up _init_from_environment even more
And do it right this time!

svn: r21898
2013-04-05 23:40:49 +00:00
John Ralls
b72ddb7f47 GrampsLocale: Improve windows handling of no locale
svn: r21882
2013-04-04 21:06:19 +00:00
John Ralls
04c146669b GrampsLocale: Ensure posix collation and calendar are set correctly
svn: r21881
2013-04-04 21:06:09 +00:00
John Ralls
fc23bbd93a GrampsLocale: Better handling of unset $LANG or $LANG == 'C'
svn: r21880
2013-04-04 21:04:48 +00:00
John Ralls
a8c7156b76 GrampsLocale: Fix MSWin Syntax error
Can't do everything the C way :-(

svn: r21858
2013-04-03 03:55:17 +00:00
John Ralls
ea9ddaba69 GrampsLocale: Win: Check both forward and reverse mslocale
svn: r21854
2013-04-02 20:25:08 +00:00
John Ralls
a15e676eef [Bug 6495] Translator class should use english date
When "English" is set via libtranslate.

svn: r21844
2013-04-02 00:05:50 +00:00
John Ralls
a3cc615398 GrampsLocale: Fix NoneType error
svn: r21839
2013-04-01 17:34:26 +00:00
John Ralls
0cab5e576c GrampsLocale: Better initialization from environment
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
2013-03-31 22:46:25 +00:00
John Ralls
f432853dc4 GrampsLocale: Separate self.encoding from sys.stdout.encoding
Because python standard library functions encode to
locale.getpreferredencoding or sys.getdefaultencoding, not to
sys.stdout.encoding.

svn: r21753
2013-03-26 19:16:49 +00:00
Nick Hall
5adc2102a2 Add Tag class to CallbackManager
svn: r21727
2013-03-23 22:26:35 +00:00
John Ralls
548507008b GrampsLocale: Ensure correct stdout encoding
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
2013-03-19 18:22:19 +00:00
John Ralls
ec787da3fa GrampsLocale: Prevent some AttributeErrors and 'referenced before assignment' errors.
svn: r21693
2013-03-19 18:21:41 +00:00
Tim G L Lyons
d643dde344 Standardise messages about missing modules to include problem, consequence and what to do about it (currently including references to GEPS 029 where necessary).
svn: r21671
2013-03-17 11:40:33 +00:00
John Ralls
29292a404a GrampsLocale: Code cleanup
And make sure that setting lang on the GrampsLocale constructor
overrides the languages from the first instance.

svn: r21646
2013-03-14 23:01:09 +00:00
John Ralls
66ded552dd GrampsLocale: Suppress double printing of log messages
Grampsapp.py sets a global handler, so install one only during the first init and remove it when done.

svn: r21644
2013-03-14 23:00:57 +00:00
John Ralls
c25d94b3a7 GrampsLocale: Reduce circular imports
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
2013-03-13 00:05:46 +00:00
John Ralls
f270f08be8 GrampsLocale: Better handle invalid/missing locale
svn: r21636
2013-03-12 22:22:58 +00:00
John Ralls
9e844f0d64 MacLocale: Extract function _mac_get_gramps_defaults
And correct line handling on the languages list.

svn: r21635
2013-03-12 22:22:53 +00:00
John Ralls
33d9b19ac7 GrampsLocale: Ensure that encoding gets set to something
In the C locale, locale.getlocale() returns [None, None]

svn: r21616
2013-03-11 22:44:29 +00:00
John Ralls
fa0eb6cebe Determine Paths at Runtime
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
2013-03-11 22:43:58 +00:00
John Ralls
56e29c162b GrampsLocale: Protect another setlocale instance
svn: r21612
2013-03-11 22:43:52 +00:00
Paul Franklin
55e2863a0b sync a few files in gramps40 and trunk
svn: r21603
2013-03-10 21:51:52 +00:00
John Ralls
b60dbf2782 Grampslocale: Protect from crashes due to passing bad strings to setlocale
svn: r21597
2013-03-09 22:31:13 +00:00
John Ralls
40ff796d93 Mac: Improve language list handling
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
2013-03-09 22:31:06 +00:00
John Ralls
068d50cc26 GrampsLocale: Improve handling the language list
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
2013-03-09 22:31:00 +00:00
Jérôme Rapinat
9856e108e6 "os" is not defined
svn: r21588
2013-03-09 12:15:39 +00:00
John Ralls
b262eeaab7 get_unicode_path_from_env_var(): make no-op if it's already unicode
svn: r21561
2013-03-06 01:07:05 +00:00
John Ralls
b57e7b7508 GrampsLocale:Move setlocale from _set_from_environment to __init_first_instance
So that encoding is set for Mac as well.

svn: r21554
2013-03-05 17:23:21 +00:00
John Ralls
694f757463 GrampsLocale: Add _win_bindtextdomain
Adapted from init_windows_gettext in Gramps3.
Libintl-8.dll must be on the path, just like all of the other C-library
dependencies.



svn: r21540
2013-03-03 23:40:27 +00:00
John Ralls
649bdf7bb7 GrampsLocale: Restore setlocale, add GrampsLocale.encoding
encoding to replace translation().info()['encoding'] which isn't 
the encoding we're looking for. 

svn: r21539
2013-03-03 21:55:02 +00:00
John Ralls
f6ab91e87f GrampsLocale: Create GrampsTranslation attribute for language
Rather than relying on translators to correctly fill out po files

svn: r21526
2013-03-02 20:25:07 +00:00
John Ralls
67e975b31f GrampsLocale: Fix glocale without import
svn: r21525
2013-03-02 20:25:01 +00:00
John Ralls
ee7fdca6ef MacLocale: Handle AppleCollationOrder returning "root"
svn: r21491
2013-02-28 18:57:37 +00:00
John Ralls
1e41e76682 MacLocale: Allow $LANG to override defaults settings
For currency, calendar, and collation

svn: r21490
2013-02-28 18:57:31 +00:00
John Ralls
991447264a GrampsLocale: Handle errors in getting collation key from locale module
svn: r21489
2013-02-28 18:57:25 +00:00
John Ralls
38dcbbae58 GrampsLocale: Restore call to locale.bindtextdomain() for GtkBuilder
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
2013-02-28 18:57:19 +00:00
John Ralls
ca80adeb01 GrampsLocale: Set collation, currency, and calendar to lang only on secondary locale objects.
svn: r21487
2013-02-28 18:57:13 +00:00
John Ralls
4eb3e7c926 GrampsLocale: Fix get_addon_translator path
Add the locale subdirectory.
Also clean out some cruft left over from the old implementation.

svn: r21485
2013-02-28 18:56:59 +00:00
Helge Herz
bf438cddd6 Python less 3.x uses GdkPixbuf.new_subpixbuf instead dkPixbuf.subpixbuf issue 6487
svn: r21477
2013-02-27 22:24:14 +00:00
John Ralls
138bbb047b GrampsLocale: Remove all calls to locale.setlocale and locale.bindtextdomain
svn: r21451
2013-02-26 00:16:41 +00:00
John Ralls
07b52e2a11 ConfigManager: Ensure key files are loaded and saved as utf-8
svn: r21447
2013-02-26 00:15:55 +00:00
John Ralls
6f8fc1be58 Work around lack of locale.LC_MESSAGES on some Windows pythons
svn: r21436
2013-02-24 17:38:43 +00:00