Link to translated wiki pages in welcome gramplet

This commit is contained in:
Nick Hall 2022-02-25 21:45:34 +00:00
parent d72ffb47a8
commit a10de553c1

View File

@ -31,6 +31,7 @@ from gi.repository import Gtk
#------------------------------------------------------------------------ #------------------------------------------------------------------------
from gramps.gen.const import URL_WIKISTRING, URL_MANUAL_PAGE, URL_HOMEPAGE from gramps.gen.const import URL_WIKISTRING, URL_MANUAL_PAGE, URL_HOMEPAGE
from gramps.gen.const import WIKI_EXTRAPLUGINS from gramps.gen.const import WIKI_EXTRAPLUGINS
from gramps.gui.display import EXTENSION
from gramps.gen.plug import Gramplet from gramps.gen.plug import Gramplet
from gramps.gui.widgets.styledtexteditor import StyledTextEditor from gramps.gui.widgets.styledtexteditor import StyledTextEditor
from gramps.gen.lib import StyledText, StyledTextTag, StyledTextTagType from gramps.gen.lib import StyledText, StyledTextTag, StyledTextTagType
@ -59,6 +60,16 @@ def linkst(text, url):
tags = [StyledTextTag(StyledTextTagType.LINK, url, [(0, len(text))])] tags = [StyledTextTag(StyledTextTagType.LINK, url, [(0, len(text))])]
return StyledText('') + StyledText(text, tags) return StyledText('') + StyledText(text, tags)
def wiki(page, manual=False):
"""
Build a link to a wiki page.
"""
url = URL_WIKISTRING
if manual:
url += URL_MANUAL_PAGE
url += page + EXTENSION
return url
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #
# Gramplet class # Gramplet class
@ -117,8 +128,7 @@ class WelcomeGramplet(Gramplet):
'There is an active community of users available on the mailing' 'There is an active community of users available on the mailing'
' lists and Discourse forum to share ideas and techniques.\n\n') ' lists and Discourse forum to share ideas and techniques.\n\n')
welcome += linkst(_('Gramps online manual'), welcome += linkst(_('Gramps online manual'),
URL_WIKISTRING + URL_MANUAL_PAGE + wiki('', manual=True)) + '\n\n'
_('', 'locale_suffix')) + '\n\n'
welcome += linkst(_('Ask questions on gramps-users mailing list'), welcome += linkst(_('Ask questions on gramps-users mailing list'),
'%(gramps_home_url)scontact/' % '%(gramps_home_url)scontact/' %
{'gramps_home_url': URL_HOMEPAGE}) + '\n\n' {'gramps_home_url': URL_HOMEPAGE}) + '\n\n'
@ -135,8 +145,7 @@ class WelcomeGramplet(Gramplet):
' family, or importing a family tree. For more details, please' ' family, or importing a family tree. For more details, please'
' read the information at the links below.\n\n') ' read the information at the links below.\n\n')
welcome += linkst(_('Start with Genealogy and Gramps'), welcome += linkst(_('Start with Genealogy and Gramps'),
'%(gramps_wiki_url)sStart_with_Genealogy' % wiki('Start_with_Genealogy')) + '\n\n'
{'gramps_wiki_url': URL_WIKISTRING}) + '\n\n'
welcome += boldst(_('Enter your first Family')) + '\n\n' + _( welcome += boldst(_('Enter your first Family')) + '\n\n' + _(
'You will now want to start entering your first Family and that' 'You will now want to start entering your first Family and that'
' starts with the first Person.\n\n' ' starts with the first Person.\n\n'
@ -160,16 +169,15 @@ class WelcomeGramplet(Gramplet):
' doing most activities in Gramps. The flexibility allows you to' ' doing most activities in Gramps. The flexibility allows you to'
' choose which fits your work style.\n\n') ' choose which fits your work style.\n\n')
welcome += linkst(_('Entering and editing data (brief)'), welcome += linkst(_('Entering and editing data (brief)'),
'%(gramps_wiki_url)s_-_Entering_and_editing_data:_brief' % wiki('_-_Entering_and_editing_data:_brief',
{'gramps_wiki_url': URL_WIKISTRING + URL_MANUAL_PAGE}) + '\n\n' manual=True)) + '\n\n'
welcome += boldst(_('Importing a Family Tree')) + '\n\n' + _( welcome += boldst(_('Importing a Family Tree')) + '\n\n' + _(
'To import a Family Tree from another program first create' 'To import a Family Tree from another program first create'
' a GEDCOM (or other data) file from the previous program.\n\n' ' a GEDCOM (or other data) file from the previous program.\n\n'
'Once you have created a new Gramps database file, use the "Import"' 'Once you have created a new Gramps database file, use the "Import"'
' option under the "Family Trees" menu to import the GEDCOM data.\n\n') ' option under the "Family Trees" menu to import the GEDCOM data.\n\n')
welcome += linkst(_('Import from another genealogy program'), welcome += linkst(_('Import from another genealogy program'),
'%(gramps_wiki_url)sImport_from_another_genealogy_program' % wiki('Import_from_another_genealogy_program')) + '\n\n'
{'gramps_wiki_url': URL_WIKISTRING}) + '\n\n'
welcome += boldst(_('Dashboard View')) + '\n\n' + _( welcome += boldst(_('Dashboard View')) + '\n\n' + _(
'You are currently reading from the "Dashboard" view, where you can' 'You are currently reading from the "Dashboard" view, where you can'
' add your own gramplets. You can also add gramplets to any view by' ' add your own gramplets. You can also add gramplets to any view by'
@ -182,15 +190,14 @@ class WelcomeGramplet(Gramplet):
' float above Gramps.') ' float above Gramps.')
welcome += '\n\n' welcome += '\n\n'
welcome += linkst(_('Gramps View Categories'), welcome += linkst(_('Gramps View Categories'),
'%(gramps_wiki_url)s_-_Categories' % wiki('_-_Categories', manual=True)) + '\n\n'
{'gramps_wiki_url': URL_WIKISTRING + URL_MANUAL_PAGE}) + '\n\n'
welcome += boldst(_('Addons and "Gramplets"')) + '\n\n' + _( welcome += boldst(_('Addons and "Gramplets"')) + '\n\n' + _(
'There many Addons or "Gramplets" that are available to assist you' 'There many Addons or "Gramplets" that are available to assist you'
' in data entry and visualizing your family tree. Many of these tools' ' in data entry and visualizing your family tree. Many of these tools'
' are already available to you. Many more are available to download' ' are already available to you. Many more are available to download'
' and install.\n\n') ' and install.\n\n')
welcome += linkst(_('Addons and "Gramplets"'), welcome += linkst(_('Addons and "Gramplets"'),
URL_WIKISTRING + WIKI_EXTRAPLUGINS) + '\n\n' wiki(WIKI_EXTRAPLUGINS)) + '\n\n'
welcome += boldst(_('Example Database')) + '\n\n' + _( welcome += boldst(_('Example Database')) + '\n\n' + _(
'Want to see Gramps in use. Create and Import the Example database.\n\n' 'Want to see Gramps in use. Create and Import the Example database.\n\n'
'Create a new Family Tree as described above. Suggest that you name' 'Create a new Family Tree as described above. Suggest that you name'
@ -199,8 +206,7 @@ class WelcomeGramplet(Gramplet):
'Follow the instructions for the location of the file stored with' 'Follow the instructions for the location of the file stored with'
' the Gramps program.\n\n') ' the Gramps program.\n\n')
welcome += linkst(_('Example.gramps'), welcome += linkst(_('Example.gramps'),
'%(gramps_wiki_url)sExample.gramps' % wiki('Example.gramps')) + '\n\n'
{'gramps_wiki_url': URL_WIKISTRING}) + '\n\n'
self.texteditor.set_text(welcome) self.texteditor.set_text(welcome)