Skip to content

Commit

Permalink
Add translations
Browse files Browse the repository at this point in the history
  • Loading branch information
amka committed Aug 29, 2020
1 parent d92f628 commit 3513370
Show file tree
Hide file tree
Showing 25 changed files with 970 additions and 145 deletions.
81 changes: 42 additions & 39 deletions com.tenderowl.norka.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"runtime-version" : "3.36",
"command" : "com.github.tenderowl.norka",
"finish-args" : [
"--filesystem=home",
"--filesystem=home",
"--share=ipc",
"--share=network",
"--socket=fallback-x11",
Expand Down Expand Up @@ -62,78 +62,81 @@
]
},
{
"name": "gtkspell",
"sources": [
"name" : "gtkspell",
"sources" : [
{
"type": "archive",
"url": "https://downloads.sourceforge.net/project/gtkspell/3.0.10/gtkspell3-3.0.10.tar.xz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fgtkspell%2Ffiles%2F3.0.10%2Fgtkspell3-3.0.10.tar.xz%2Fdownload&ts=1572946840",
"sha256": "b040f63836b347eb344f5542443dc254621805072f7141d49c067ecb5a375732"
"type" : "archive",
"url" : "https://downloads.sourceforge.net/project/gtkspell/3.0.10/gtkspell3-3.0.10.tar.xz?r=https%3A%2F%2Fsourceforge.net%2Fprojects%2Fgtkspell%2Ffiles%2F3.0.10%2Fgtkspell3-3.0.10.tar.xz%2Fdownload&ts=1572946840",
"sha256" : "b040f63836b347eb344f5542443dc254621805072f7141d49c067ecb5a375732"
}
]
},
{
"name": "python3-mistune",
"buildsystem": "simple",
"build-commands": [
"name" : "python3-mistune",
"buildsystem" : "simple",
"build-commands" : [
"pip3 install --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} mistune"
],
"sources": [
"sources" : [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/dc/ed/8315978a49ef7209a92e7ec5e38235c30db547d2afdf094355b6e71646b7/mistune-2.0.0a4-py2.py3-none-any.whl",
"sha256": "ebbed6e25e342705ec30f3184bdc148229dfbae0da6136c2a6892333c9f8bc6b"
"type" : "file",
"url" : "https://files.pythonhosted.org/packages/dc/ed/8315978a49ef7209a92e7ec5e38235c30db547d2afdf094355b6e71646b7/mistune-2.0.0a4-py2.py3-none-any.whl",
"sha256" : "ebbed6e25e342705ec30f3184bdc148229dfbae0da6136c2a6892333c9f8bc6b"
}
]
},
{
"name": "python3-requests",
"buildsystem": "simple",
"build-commands": [
"name" : "python3-requests",
"buildsystem" : "simple",
"build-commands" : [
"pip3 install --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} requests"
],
"sources": [
"sources" : [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl",
"sha256": "b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
"type" : "file",
"url" : "https://files.pythonhosted.org/packages/a2/38/928ddce2273eaa564f6f50de919327bf3a00f091b5baba8dfa9460f3a8a8/idna-2.10-py2.py3-none-any.whl",
"sha256" : "b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl",
"sha256": "88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"
"type" : "file",
"url" : "https://files.pythonhosted.org/packages/e1/e5/df302e8017440f111c11cc41a6b432838672f5a70aa29227bf58149dc72f/urllib3-1.25.9-py2.py3-none-any.whl",
"sha256" : "88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl",
"sha256": "fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"
"type" : "file",
"url" : "https://files.pythonhosted.org/packages/45/1e/0c169c6a5381e241ba7404532c16a21d86ab872c9bed8bdcd4c423954103/requests-2.24.0-py2.py3-none-any.whl",
"sha256" : "fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl",
"sha256": "8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"
"type" : "file",
"url" : "https://files.pythonhosted.org/packages/5e/c4/6c4fe722df5343c33226f0b4e0bb042e4dc13483228b4718baf286f86d87/certifi-2020.6.20-py2.py3-none-any.whl",
"sha256" : "8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl",
"sha256": "fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
"type" : "file",
"url" : "https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl",
"sha256" : "fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
}
]
},
{
"name": "norka",
"builddir": true,
"buildsystem": "meson",
"sources": [
"name" : "norka",
"builddir" : true,
"buildsystem" : "meson",
"sources" : [
{
"type": "git",
"url": "https://github.com/TenderOwl/Norka.git"
"type" : "git",
"url" : "https://github.com/TenderOwl/Norka.git"
}
]
}
],
"build-options" : {
"env" : {
"GTK_DEBUG" : "interactive"
"GTK_DEBUG" : "interactive",
"GOBJECT_DEBUG" : "instance-count",
"LANG" : "ru_RU.UTF-8",
"LANGUAGE" : "ru"
}
}
}
4 changes: 2 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ find_program('gtk-update-icon-cache', required: false)
find_program('update-desktop-database', required: false)

gettext_package = meson.project_name()
localedir = get_option('localedir')
localedir = join_paths(get_option('prefix'), get_option('localedir'))
pythondir = join_paths(get_option('prefix'), python.sysconfig_path('purelib'))
datadir = get_option('datadir')
pkgdatadir = join_paths(get_option('prefix'), datadir, meson.project_name())
Expand All @@ -40,7 +40,7 @@ podir = meson.source_root() / 'po'
conf = configuration_data()
conf.set('PACKAGE_URL', 'https://tenderowl.com/norka/')
conf.set('DATA_DIR', get_option('datadir'))
conf.set('LOCALE_DIR', join_paths(get_option('datadir'), 'locale'))
conf.set('LOCALE_DIR', localedir)
conf.set('PYTHON_DIR', pythondir)
conf.set('PROJECT_NAME', meson.project_name())
conf.set('VERSION', meson.project_version())
Expand Down
3 changes: 2 additions & 1 deletion norka/define.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from gettext import gettext as _

APP_ID = 'com.github.tenderowl.norka'
APP_TITLE = 'Norka'
APP_SUBTITLE = 'continuous text editor'
APP_SUBTITLE = _('continuous text editor')

DEBUG = False

Expand Down
10 changes: 9 additions & 1 deletion norka/norka.in
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ import os
import sys
import signal
import gettext
import locale


VERSION = '@VERSION@'
REVISION = '@REVISION@'
Expand All @@ -41,7 +43,13 @@ project_name = '@PROJECT_NAME@'

sys.path.insert(1, '@PYTHON_DIR@')
signal.signal(signal.SIGINT, signal.SIG_DFL)
gettext.install('norka', localedir)

locale.textdomain(project_name)
locale.bindtextdomain(project_name, localedir)
gettext.textdomain(project_name)
gettext.bindtextdomain(project_name, localedir)

print('GETTEXT: ', localedir, project_name, gettext.find(project_name, localedir))

if __name__ == '__main__':
import gi
Expand Down
7 changes: 5 additions & 2 deletions norka/widgets/about_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from gettext import gettext as _

from gi.repository import Gtk

from norka.define import APP_TITLE
Expand All @@ -30,10 +33,10 @@ class AboutDialog(Gtk.AboutDialog):
def __init__(self, version, transient_for, modal=False):
super().__init__(transient_for=transient_for, modal=modal)
self.set_program_name(APP_TITLE)
self.set_comments('Continuous text editor')
self.set_comments(_('Continuous text editor'))
self.set_copyright('© 2020, Tender Owl')
self.set_website("https://tenderowl.com/norka")
self.set_website_label('Learn more about Norka')
self.set_website_label(_('Learn more about Norka'))
self.set_license_type(Gtk.License.MIT_X11)
self.set_version(version)

Expand Down
12 changes: 7 additions & 5 deletions norka/widgets/document_context_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from gettext import gettext as _

from gi.repository import Gtk, Granite


Expand All @@ -32,19 +34,19 @@ def __init__(self, attach_to=None, archived=False):
self.attach_to_widget(attach_to)

export_menu = Gtk.MenuItem(action_name='document.export')
export_menu.add(Granite.AccelLabel.from_action_name('Export...', 'document.export'))
export_menu.add(Granite.AccelLabel.from_action_name(_('Export...'), 'document.export'))

rename_menu = Gtk.MenuItem(action_name='document.rename')
rename_menu.add(Granite.AccelLabel.from_action_name('Rename', 'document.rename'))
rename_menu.add(Granite.AccelLabel.from_action_name(_('Rename'), 'document.rename'))

archive_menu = Gtk.MenuItem(action_name='document.archive')
archive_menu.add(Granite.AccelLabel.from_action_name('Archive', 'document.archive'))
archive_menu.add(Granite.AccelLabel.from_action_name(_('Archive'), 'document.archive'))

unarchive_menu = Gtk.MenuItem(action_name='document.unarchive')
unarchive_menu.add(Granite.AccelLabel.from_action_name('Unarchive', 'document.unarchive'))
unarchive_menu.add(Granite.AccelLabel.from_action_name(_('Unarchive'), 'document.unarchive'))

delete_menu = Gtk.MenuItem(action_name='document.delete')
delete_menu.add(Granite.AccelLabel.from_action_name('Delete', 'document.delete'))
delete_menu.add(Granite.AccelLabel.from_action_name(_('Delete'), 'document.delete'))

self.append(rename_menu)
self.append(Gtk.SeparatorMenuItem())
Expand Down
2 changes: 0 additions & 2 deletions norka/widgets/document_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
from norka.widgets.document_context_menu import DocumentContextMenu




class DocumentGrid(Gtk.Grid):
__gtype_name__ = 'DocumentGrid'

Expand Down
8 changes: 5 additions & 3 deletions norka/widgets/export_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
from gettext import gettext as _

from gi.repository import Gtk


class ExportFormat:
PlainText = ("Plain text", ("*.txt",))
Markdown = ("Markdown", (".md", ".markdown",))
Html = ("HTML", ("*.html", "*.htm"))
PlainText = (_("Plain text"), ("*.txt",))
Markdown = (_("Markdown"), (".md", ".markdown",))
Html = (_("HTML"), ("*.html", "*.htm"))


class ExportFileDialog(Gtk.FileChooserNative):
Expand Down
18 changes: 10 additions & 8 deletions norka/widgets/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

from gettext import gettext as _

from gi.repository import Gtk, Granite

from norka.define import APP_TITLE, APP_SUBTITLE
Expand All @@ -38,7 +40,7 @@ def __init__(self, settings):
self.document_mode_active = False
self.settings = settings

self.set_title(APP_TITLE)
self.set_title(_("Norka"))
self.set_subtitle(APP_SUBTITLE)
self.set_has_subtitle(True)
self.set_show_close_button(True)
Expand All @@ -48,20 +50,20 @@ def __init__(self, settings):

self.import_button = Gtk.Button.new_from_icon_name('document-open', Gtk.IconSize.LARGE_TOOLBAR)
self.import_button.set_visible(True)
self.import_button.set_tooltip_markup(Granite.markup_accel_tooltip(('<Control>o',), 'Import file to Norka'))
self.import_button.set_tooltip_markup(Granite.markup_accel_tooltip(('<Control>o',), _('Import file to Norka')))
self.import_button.set_action_name('document.import')

self.add_button = Gtk.Button.new_from_icon_name('document-new', Gtk.IconSize.LARGE_TOOLBAR)
self.add_button.set_visible(True)
self.add_button.set_tooltip_markup(Granite.markup_accel_tooltip(('<Control>n',), 'Create new document'))
self.add_button.set_tooltip_markup(Granite.markup_accel_tooltip(('<Control>n',), _('Create new document')))
self.add_button.set_action_name('document.create')

self.back_button = Gtk.Button.new_with_label('Documents')
self.back_button = Gtk.Button.new_with_label(_('Documents'))
self.back_button.set_valign(Gtk.Align.CENTER)
self.back_button.get_style_context().add_class('back-button')
self.back_button.set_tooltip_markup(Granite.markup_accel_tooltip(
('<Control>w',),
'Save document and return to documents list'))
_('Save document and return to documents list')))
self.back_button.set_visible(False)
self.back_button.set_action_name('document.close')

Expand All @@ -71,17 +73,17 @@ def __init__(self, settings):
# self.search_button.set_action_name('document.search_text')
# self.search_button.set_visible(False)

self.share_app_menu = Gtk.MenuButton(tooltip_text="Share")
self.share_app_menu = Gtk.MenuButton(tooltip_text=_("Share"))
self.share_app_menu.set_image(Gtk.Image.new_from_icon_name('document-save-as', Gtk.IconSize.LARGE_TOOLBAR))
self.share_app_menu.set_popover(MenuExport(settings=self.settings))

self.archived_button = Gtk.ToggleButton()
self.archived_button.set_image(Gtk.Image.new_from_icon_name('user-trash', Gtk.IconSize.LARGE_TOOLBAR))
self.archived_button.set_tooltip_markup(Granite.markup_accel_tooltip(None, 'Show Archived files'))
self.archived_button.set_tooltip_markup(Granite.markup_accel_tooltip(None, _('Show Archived files')))
self.archived_button.set_action_name('document.toggle_archived')
self.archived_button.set_visible(True)

self.menu_button = Gtk.MenuButton(tooltip_text="Menu")
self.menu_button = Gtk.MenuButton(tooltip_text=_("Menu"))
self.menu_button.set_image(Gtk.Image.new_from_icon_name('open-menu', Gtk.IconSize.LARGE_TOOLBAR))
self.menu_button.set_popover(MenuPopover(settings=self.settings))
self.menu_button.set_visible(True)
Expand Down
Loading

0 comments on commit 3513370

Please sign in to comment.