2008-02-15 Benny Malengier <benny.malengier@gramps-project.org>
* src/DateEdit.py: example use of help * src/GrampsDisplay.py: internationalization of help system * src/Editors/_EditPrimary.py: define_help_button link to webpage * src/Editors/_EditSecondary.py: define_help_button link to webpage * src/Editors/_EditReference.py: define_help_button link to webpage * src/Editors/_EditFamily.py: remove empty line svn: r10036
This commit is contained in:
@ -21,6 +21,39 @@
|
||||
# $Id$
|
||||
|
||||
import const
|
||||
import locale
|
||||
import os
|
||||
|
||||
#list of manuals on wiki, map locale code to wiki extension, add language codes
|
||||
#completely, or first part, so pt_BR if Brazilian portugeze wiki manual, and
|
||||
#nl for Dutch (nl_BE, nl_NL language code)
|
||||
MANUALS = {
|
||||
'nl' : '/nl',
|
||||
}
|
||||
|
||||
#first, determine language code, so nl_BE --> wiki /nl
|
||||
LANG = locale.getlocale()[0]
|
||||
if not LANG:
|
||||
LANG = 'C'
|
||||
#support environment overrule:
|
||||
try:
|
||||
if not os.environ['LANGUAGE'] or \
|
||||
os.environ['LANGUAGE'].split(':')[0] == LANG:
|
||||
pass
|
||||
else:
|
||||
LANG = os.environ['LANGUAGE'].split(':')[0]
|
||||
except:
|
||||
pass
|
||||
EXTENSION = ''
|
||||
try:
|
||||
EXTENSION = MANUALS[LANG]
|
||||
except KeyError:
|
||||
pass
|
||||
try:
|
||||
if not EXTENSION :
|
||||
EXTENSION = MANUALS[LANG.split('_')[0]]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def help(target, webpage='', section=''):
|
||||
"""
|
||||
@ -34,12 +67,15 @@ def help(target, webpage='', section=''):
|
||||
# url(const.URL_MANUAL+'en/')
|
||||
|
||||
# 3.0 Beta, direct to the wiki 3.0 Manual
|
||||
|
||||
|
||||
|
||||
if not webpage:
|
||||
link = const.URL_WIKISTRING + const.URL_MANUAL_PAGE
|
||||
link = const.URL_WIKISTRING + const.URL_MANUAL_PAGE + EXTENSION
|
||||
else:
|
||||
link = const.URL_WIKISTRING + webpage
|
||||
link = const.URL_WIKISTRING + webpage + EXTENSION
|
||||
if section:
|
||||
link + '#' + section
|
||||
link = link + '#' + section
|
||||
url(link)
|
||||
|
||||
def url(link):
|
||||
|
Reference in New Issue
Block a user