From f43bba94addb30ec9caec82c85b24ab8baedfa22 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 07:38:57 +0200 Subject: [PATCH 01/14] Add some localization --- relational.py | 45 +++++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/relational.py b/relational.py index 7b9312a..9ac585f 100755 --- a/relational.py +++ b/relational.py @@ -21,22 +21,29 @@ import sys import os import os.path import getopt +import gettext + + +gettext.bindtextdomain('relational') +gettext.textdomain('relational') +_ = gettext.gettext + version = "3.1" def printver(exit=True): print ("Relational %s" % version) - print ("Copyright (C) 2008-2020 Salvo 'LtWorf' Tomaselli.") - print () - print ("This program comes with ABSOLUTELY NO WARRANTY.") - print ("This is free software, and you are welcome to redistribute it") - print ("under certain conditions.") - print ("For details see the GPLv3 Licese.") - print () - print ("Written by Salvo 'LtWorf' Tomaselli ") - print () - print ("https://ltworf.github.io/relational/") + print (_("Copyright (C) 2008-2020 Salvo 'LtWorf' Tomaselli.\n" + "\n" + "This program comes with ABSOLUTELY NO WARRANTY.\n" + "This is free software, and you are welcome to redistribute it\n" + "under certain conditions.\n" + "For details see the GPLv3 Licese.\n" + "\n" + "Written by Salvo 'LtWorf' Tomaselli \n" + "\n" + "https://ltworf.github.io/relational/")) if exit: sys.exit(0) @@ -46,15 +53,10 @@ def printhelp(code=0): print () print ("Usage: %s [options] [files]" % sys.argv[0]) print () - print (" -v Print version and exits") - print (" -h Print this help and exits") - - if sys.argv[0].endswith('relational-cli'): - print (" -q Uses QT user interface") - print (" -r Uses readline user interface (default)") - else: - print (" -q Uses QT user interface (default)") - print (" -r Uses readline user interface") + print (_(' -v Print version and exits')) + print (_(' -h Print this help and exits')) + print (_(' -q Uses Qt user interface')) + print (_(' -r Uses readline user interface')) sys.exit(code) if __name__ == "__main__": @@ -87,8 +89,7 @@ if __name__ == "__main__": from relational_gui import guihandler, about, surveyForm except: print ( - "Module relational_gui is missing.\n" - "Please install relational package or run make.", + _('Module relational_gui is missing.\nPlease install relational package or run make.'), file=sys.stderr ) sys.exit(3) @@ -124,7 +125,7 @@ if __name__ == "__main__": printver(False) except: print ( - "Module relational_readline is missing.\nPlease install relational-cli package.", + _('Module relational_readline is missing.\nPlease install relational-cli package.'), file=sys.stderr ) sys.exit(3) From 6fa738529139cf761d2a99c5b44de93c05c69676 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 07:48:29 +0200 Subject: [PATCH 02/14] .gitignore --- po/.gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 po/.gitignore diff --git a/po/.gitignore b/po/.gitignore new file mode 100644 index 0000000..cd1f2c9 --- /dev/null +++ b/po/.gitignore @@ -0,0 +1 @@ +*.mo From f1cdcec730c7cc783c3601d5abe33ff90bfb5b89 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 07:40:24 +0200 Subject: [PATCH 03/14] Make translation and stubs --- Makefile | 23 ++++++++++++++++++- po/it.po | 41 +++++++++++++++++++++++++++++++++ po/messages.pot | 60 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 po/it.po create mode 100644 po/messages.pot diff --git a/Makefile b/Makefile index c8a9315..9b64202 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,6 @@ +.PHONY: all +all: gui translations + .PHONY: gui gui: relational_gui/survey.py relational_gui/maingui.py relational_gui/rel_edit.py relational_gui/resources.py @@ -65,6 +68,7 @@ clean: rm -f relational_gui/maingui.py rm -f relational_gui/rel_edit.py rm -f relational_gui/resources.py + $(RM) po/*.mo .PHONY: install-relational-cli install-relational-cli: @@ -74,7 +78,7 @@ install-relational-cli: install -D relational-cli.1 $${DESTDIR:-/}/usr/share/man/man1/relational-cli.1 .PHONY: install-python3-relational -install-python3-relational: +install-python3-relational: install_translations python3 setup/python3-relational.setup.py install --root=$${DESTDIR:-/}; rm -rf build; @@ -89,3 +93,20 @@ install-relational: .PHONY: install install: install-relational-cli install-python3-relational install-relational + +po/messages.pot: relational.py + xgettext --from-code=utf-8 -L Python -j -o po/messages.pot --package-name=relational \ + relational.py + +po/it.po: po/messages.pot + msgmerge --update po/it.po po/messages.pot + +po/it.mo: po/it.po + msgfmt po/it.po --output-file po/it.mo + +.PHONY: translations +translations: po/it.mo + +.PHONY: install_translations +install_translations: + install -m644 -D po/it.mo $${DESTDIR:-/}/usr/share/locale/it/LC_MESSAGES/relational.mo diff --git a/po/it.po b/po/it.po new file mode 100644 index 0000000..b9ee79f --- /dev/null +++ b/po/it.po @@ -0,0 +1,41 @@ +#: relational.py:37 +msgid "" +"Copyright (C) 2008-2020 Salvo 'LtWorf' Tomaselli.\n" +"\n" +"This program comes with ABSOLUTELY NO WARRANTY.\n" +"This is free software, and you are welcome to redistribute it\n" +"under certain conditions.\n" +"For details see the GPLv3 Licese.\n" +"\n" +"Written by Salvo 'LtWorf' Tomaselli \n" +"\n" +"https://ltworf.github.io/relational/" +msgstr "" + +#: relational.py:56 +msgid " -v Print version and exits" +msgstr "" + +#: relational.py:57 +msgid " -h Print this help and exits" +msgstr "" + +#: relational.py:58 +msgid " -q Uses Qt user interface" +msgstr "" + +#: relational.py:59 +msgid " -r Uses readline user interface" +msgstr "" + +#: relational.py:92 +msgid "" +"Module relational_gui is missing.\n" +"Please install relational package or run make." +msgstr "" + +#: relational.py:128 +msgid "" +"Module relational_readline is missing.\n" +"Please install relational-cli package." +msgstr "" diff --git a/po/messages.pot b/po/messages.pot new file mode 100644 index 0000000..530abd9 --- /dev/null +++ b/po/messages.pot @@ -0,0 +1,60 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the relational package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: relational\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-21 08:13+0200\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: relational.py:37 +msgid "" +"Copyright (C) 2008-2020 Salvo 'LtWorf' Tomaselli.\n" +"\n" +"This program comes with ABSOLUTELY NO WARRANTY.\n" +"This is free software, and you are welcome to redistribute it\n" +"under certain conditions.\n" +"For details see the GPLv3 Licese.\n" +"\n" +"Written by Salvo 'LtWorf' Tomaselli \n" +"\n" +"https://ltworf.github.io/relational/" +msgstr "" + +#: relational.py:56 +msgid " -v Print version and exits" +msgstr "" + +#: relational.py:57 +msgid " -h Print this help and exits" +msgstr "" + +#: relational.py:58 +msgid " -q Uses Qt user interface" +msgstr "" + +#: relational.py:59 +msgid " -r Uses readline user interface" +msgstr "" + +#: relational.py:92 +msgid "" +"Module relational_gui is missing.\n" +"Please install relational package or run make." +msgstr "" + +#: relational.py:128 +msgid "" +"Module relational_readline is missing.\n" +"Please install relational-cli package." +msgstr "" From c5bb52880e30b3b31ced8f45f76019e83d2b2367 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 08:21:21 +0200 Subject: [PATCH 04/14] Some italian strings --- po/it.po | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/po/it.po b/po/it.po index b9ee79f..917127a 100644 --- a/po/it.po +++ b/po/it.po @@ -1,3 +1,20 @@ +# Header entry was created by Lokalize. +# +#: relational.py:37 +# Salvo Tomaselli , 2020. +msgid "" +msgstr "" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Last-Translator: Salvo Tomaselli \n" +"PO-Revision-Date: 2020-10-21 08:20+0200\n" +"Project-Id-Version: \n" +"Language-Team: Italian \n" +"Language: it\n" +"MIME-Version: 1.0\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"X-Generator: Lokalize 20.04.3\n" + #: relational.py:37 msgid "" "Copyright (C) 2008-2020 Salvo 'LtWorf' Tomaselli.\n" @@ -14,28 +31,32 @@ msgstr "" #: relational.py:56 msgid " -v Print version and exits" -msgstr "" +msgstr " -v mostra le informazioni sulla versione ed esce" #: relational.py:57 msgid " -h Print this help and exits" -msgstr "" +msgstr " -h mostra questo aiuto ed esce" #: relational.py:58 msgid " -q Uses Qt user interface" -msgstr "" +msgstr " -q Usa l'interfaccia Qt" #: relational.py:59 msgid " -r Uses readline user interface" -msgstr "" +msgstr " -r Usa l'interfaccia readline" #: relational.py:92 msgid "" "Module relational_gui is missing.\n" "Please install relational package or run make." msgstr "" +"Il modulo relational_gui manca. " +"Installare il pacchetto relational o eseguire make." #: relational.py:128 msgid "" "Module relational_readline is missing.\n" "Please install relational-cli package." msgstr "" +"Il modulo relational_readline manca. " +"Installare il pacchetto relational-cli." From 820d10a44ce450ff5503c741dc7d12f6905c821f Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 13:52:45 +0200 Subject: [PATCH 05/14] Scan more source files --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9b64202..24e5665 100644 --- a/Makefile +++ b/Makefile @@ -94,9 +94,12 @@ install-relational: .PHONY: install install: install-relational-cli install-python3-relational install-relational -po/messages.pot: relational.py +po/messages.pot: relational.py relational/*.py relational_readline/*.py relational_gui/*.py xgettext --from-code=utf-8 -L Python -j -o po/messages.pot --package-name=relational \ - relational.py + relational.py \ + relational_readline/*.py \ + relational_gui/*.py \ + relational/*.py po/it.po: po/messages.pot msgmerge --update po/it.po po/messages.pot From c64fc009873a562700cb51a5c62c1b52c99fd033 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 13:56:59 +0200 Subject: [PATCH 06/14] Localize strings --- relational/maintenance.py | 9 +++++---- relational/parser.py | 16 +++++++++------- relational/relation.py | 21 +++++++++++---------- relational/rtypes.py | 3 ++- 4 files changed, 27 insertions(+), 22 deletions(-) diff --git a/relational/maintenance.py b/relational/maintenance.py index f72c3da..218850c 100644 --- a/relational/maintenance.py +++ b/relational/maintenance.py @@ -22,6 +22,7 @@ import os.path import pickle import base64 from typing import Optional, Tuple +from gettext import gettext as _ from relational.relation import Relation from relational import parser @@ -153,7 +154,7 @@ class UserInterface: def set_relation(self, name: str, rel: Relation) -> None: '''Sets the relation corresponding to name.''' if not is_valid_relation_name(name): - raise Exception('Invalid name for destination relation') + raise Exception(_('Invalid name for destination relation')) self.relations[name] = rel def suggest_name(self, filename: str) -> Optional[str]: @@ -184,7 +185,7 @@ class UserInterface: relname is not None, adds the result to the dictionary, with the name given in relname.''' if not is_valid_relation_name(relname): - raise Exception('Invalid name for destination relation') + raise Exception(_('Invalid name for destination relation')) expr = parser.parse(query) result = expr(self.relations) @@ -226,10 +227,10 @@ class UserInterface: try: r = self.execute(query, relname) except Exception as e: - raise Exception('Error in query: %s\n%s' % ( + raise Exception(_('Error in query: %s\n%s') % ( query, str(e) )) if r is None: - raise Exception('No query executed') + raise Exception(_('No query executed')) return r diff --git a/relational/parser.py b/relational/parser.py index af508bd..2bc1f26 100644 --- a/relational/parser.py +++ b/relational/parser.py @@ -26,6 +26,7 @@ # http://ltworf.github.io/relational/grammar.html from typing import Optional, Union, List, Any, Dict, Literal from dataclasses import dataclass +from gettext import gettext as _ from relational import rtypes @@ -55,6 +56,7 @@ __all__ = [ 'parse', ] + PRODUCT = '*' DIFFERENCE = '-' UNION = '∪' @@ -305,7 +307,7 @@ def parse_tokens(expression: List[Union[list, str]]) -> Node: expression = expression[0] if len(expression) == 0: - raise ParserException('Failed to parse empty expression') + raise ParserException(_('Failed to parse empty expression')) # The list contains only 1 string. Means it is the name of a relation if len(expression) == 1: @@ -330,28 +332,28 @@ def parse_tokens(expression: List[Union[list, str]]) -> Node: if len(expression[:i]) == 0: raise ParserException( - f'Expected left operand for {expression[i]!r}') + _(f'Expected left operand for {expression[i]!r}')) if len(expression[i + 1:]) == 0: raise ParserException( - f'Expected right operand for {expression[i]!r}') + _(f'Expected right operand for {expression[i]!r}')) return Binary(expression[i], parse_tokens(expression[:i]), parse_tokens(expression[i + 1:])) # type: ignore '''Searches for unary operators, parsing from right to left''' for i in range(len(expression)): if expression[i] in u_operators: # Unary operator if len(expression) <= i + 2: raise ParserException( - f'Expected more tokens in {expression[i]!r}') + _(f'Expected more tokens in {expression[i]!r}')) elif len(expression) > i + 3: raise ParserException( - f'Too many tokens in {expression[i]!r}') + _(f'Too many tokens in {expression[i]!r}')) return Unary( expression[i], # type: ignore prop=expression[1 + i].strip(), # type: ignore child=parse_tokens(expression[2 + i]) # type: ignore ) - raise ParserException(f'Parse error on {expression!r}') + raise ParserException(_(f'Parse error on {expression!r}')) def _find_matching_parenthesis(expression: str, start=0, openpar='(', closepar=')') -> Optional[int]: @@ -421,7 +423,7 @@ def tokenize(expression: str) -> list: end = _find_matching_parenthesis(expression) if end is None: raise TokenizerException( - "Missing matching ')' in '%s'" % expression) + _(f'Missing matching \')\' in \'{expression}\'')) # Appends the tokenization of the content of the parenthesis items.append(tokenize(expression[1:end])) # Removes the entire parentesis and content from the expression diff --git a/relational/relation.py b/relational/relation.py index 1984ec7..10c4c4c 100644 --- a/relational/relation.py +++ b/relational/relation.py @@ -24,6 +24,7 @@ from collections import deque from typing import FrozenSet, Iterable, List, Dict, Tuple, Optional from dataclasses import dataclass from pathlib import Path +from gettext import gettext as _ from relational.rtypes import * @@ -88,7 +89,7 @@ class Relation: content = [] for row in loaded['content']: if len(row) != len(header): - raise ValueError(f'Line {row} contains an incorrect amount of values') + raise ValueError(_(f'Line {row} contains an incorrect amount of values')) t_row: Tuple[Optional[Union[int, float, str, Rdate]], ...] = load( row, Tuple[Optional[Union[int, float, str, Rdate]], ...], # type: ignore @@ -136,7 +137,7 @@ class Relation: for row in content: if len(row) != len(header): - raise ValueError(f'Line {row} contains an incorrect amount of values') + raise ValueError(_(f'Line {row} contains an incorrect amount of values')) r_content.append(row) # Guess types @@ -169,7 +170,7 @@ class Relation: return other elif len(self.header) == len(other.header) and self.header.sharedAttributes(other.header) == len(self.header): return other.projection(self.header) - raise TypeError('Relations differ: [%s] [%s]' % ( + raise TypeError(_('Relations differ: [%s] [%s]') % ( ','.join(self.header), ','.join(other.header) )) @@ -180,7 +181,7 @@ class Relation: try: c_expr = compile(expr, 'selection', 'eval') except: - raise Exception(f'Failed to compile expression: {expr}') + raise Exception(_(f'Failed to compile expression: {expr}')) content = [] for i in self.content: @@ -193,7 +194,7 @@ class Relation: if eval(c_expr, attributes): content.append(i) except Exception as e: - raise Exception(f'Failed to evaluate {expr} with {i}\n{e}') + raise Exception(_(f'Failed to evaluate {expr} with {i}\n{e}')) return Relation(self.header, frozenset(content)) def product(self, other: 'Relation') -> 'Relation': @@ -205,7 +206,7 @@ class Relation: raise Exception('Operand must be a relation') if self.header.sharedAttributes(other.header) != 0: raise Exception( - 'Unable to perform product on relations with colliding attributes' + _('Unable to perform product on relations with colliding attributes') ) header = Header(self.header + other.header) @@ -231,7 +232,7 @@ class Relation: ids = self.header.getAttributesId(attributes) if len(ids) == 0: - raise Exception('Invalid attributes for projection') + raise Exception(_('Invalid attributes for projection')) header = Header((self.header[i] for i in ids)) content = frozenset(tuple((i[j] for j in ids)) for i in self.content) @@ -472,7 +473,7 @@ class Header(tuple): for i in self: if not is_valid_relation_name(i): - raise Exception(f'"{i}" is not a valid attribute name') + raise Exception(_(f'"{i}" is not a valid attribute name')) if len(self) != len(set(self)): raise Exception('Attribute names must be unique') @@ -488,12 +489,12 @@ class Header(tuple): attrs = list(self) for old, new in params.items(): if not is_valid_relation_name(new): - raise Exception(f'{new} is not a valid attribute name') + raise Exception(_(f'{new} is not a valid attribute name')) try: id_ = attrs.index(old) attrs[id_] = new except: - raise Exception(f'Field not found: {old}') + raise Exception(_(f'Field not found: {old}')) return Header(attrs) def sharedAttributes(self, other: 'Header') -> int: diff --git a/relational/rtypes.py b/relational/rtypes.py index 29f9aae..69944a3 100644 --- a/relational/rtypes.py +++ b/relational/rtypes.py @@ -25,6 +25,7 @@ import keyword import re from typing import Union, Set, Any, Callable, Type, Optional from dataclasses import dataclass +from gettext import gettext as _ RELATION_NAME_REGEXP = re.compile(r'^[_a-z][_a-z0-9]*$', re.IGNORECASE) @@ -83,7 +84,7 @@ class Rdate: '''date: A string representing a date YYYY-MM-DD''' r = _date_regexp.match(date) if not r: - raise ValueError(f'{date} is not a valid date') + raise ValueError(_(f'{date} is not a valid date')) year = int(r.group(1)) month = int(r.group(3)) From 69cbad353a66e73b71dccee149774628764cb56d Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 13:57:18 +0200 Subject: [PATCH 07/14] CHANGELOG --- CHANGELOG | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index e68b73e..8b735f7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,7 @@ 3.1 - Fix version check +- Add support for localization +- Add Italian localization 3.0 - UI shows different colours for different types From 4dba82aaaa717efbd822ebf59ccbce94caad036d Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Wed, 21 Oct 2020 22:21:48 +0200 Subject: [PATCH 08/14] Localise readline --- relational_readline/linegui.py | 45 +++++++++++++++++----------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/relational_readline/linegui.py b/relational_readline/linegui.py index fea09cb..883e94b 100644 --- a/relational_readline/linegui.py +++ b/relational_readline/linegui.py @@ -24,6 +24,7 @@ import os.path import os import sys from typing import Optional +from gettext import gettext as _ from relational import relation, parser, rtypes from relational import maintenance @@ -122,7 +123,7 @@ def load_relation(filename: str, defname: Optional[str]) -> Optional[str]: ''' if not os.path.isfile(filename): print(colorize( - f'{filename} is not a file', ERROR_COLOR), file=sys.stderr) + _(f'{filename} is not a file'), ERROR_COLOR), file=sys.stderr) return None if defname is None: @@ -132,14 +133,14 @@ def load_relation(filename: str, defname: Optional[str]) -> Optional[str]: defname = defname[:-4] if not rtypes.is_valid_relation_name(defname): - print(colorize( - "%s is not a valid relation name" % defname, ERROR_COLOR), file=sys.stderr) + print(colorize(_( + '%s is not a valid relation name') % defname, ERROR_COLOR), file=sys.stderr) return None try: ui.load(filename, defname) completer.add_completion(defname) - printtty(colorize("Loaded relation %s" % defname, COLOR_GREEN)) + printtty(colorize(_('Loaded relation %s' % defname, COLOR_GREEN)) return defname except Exception as e: print(colorize(str(e), ERROR_COLOR), file=sys.stderr) @@ -157,14 +158,14 @@ def survey() -> None: post[i] = a response = maintenance.send_survey(post) if response == -1: - print('Yeah, not sending that.') + print(_('Yeah, not sending that.')) def help(command: str) -> None: '''Prints help on the various functions''' p = command.split(' ', 1) if len(p) == 1: - print( + print(_( 'HELP [command]\n' '\n' 'Comments are obtained starting with a ;\n' @@ -179,20 +180,20 @@ def help(command: str) -> None: 'To insert relational operators, type _OPNAME, they will be internally replaced with the correct symbol.\n' '\n' 'Rember: completion is enabled and can be very helpful if you can\'t remember something.' - ) + )) return cmd = p[1] cmdhelp = { - 'QUIT': 'Quits the program', - 'LIST': 'Lists the relations loaded', - 'LOAD': 'LOAD filename [relationame]\nLoads a relation into memory', - 'UNLOAD': 'UNLOAD relationame\nUnloads a relation from memory', - 'SAVE': 'SAVE filename relationame\nSaves a relation in a file', - 'HELP': 'Prints the help on a command', - 'SURVEY': 'Fill and send a survey', + 'QUIT': _('Quits the program'), + 'LIST': _('Lists the relations loaded'), + 'LOAD': _('LOAD filename [relationame]\nLoads a relation into memory'), + 'UNLOAD': _('UNLOAD relationame\nUnloads a relation from memory'), + 'SAVE': _('SAVE filename relationame\nSaves a relation in a file'), + 'HELP': _('Prints the help on a command'), + 'SURVEY': _('Fill and send a survey'), } - print(cmdhelp.get(cmd, 'Unknown command: %s' % cmd)) + print(cmdhelp.get(cmd, _('Unknown command: %s') % cmd)) def exec_line(command: str) -> None: @@ -218,7 +219,7 @@ def exec_line(command: str) -> None: elif command.startswith('LOAD '): # Loads a relation pars = command.split(' ') if len(pars) == 1: - print(colorize("Missing parameter", ERROR_COLOR)) + print(colorize(_("Missing parameter"), ERROR_COLOR)) return filename = pars[1] @@ -230,18 +231,18 @@ def exec_line(command: str) -> None: elif command.startswith('UNLOAD '): pars = command.split(' ') if len(pars) < 2: - print(colorize("Missing parameter", ERROR_COLOR)) + print(colorize(_("Missing parameter"), ERROR_COLOR)) elif len(pars) > 2: - print(colorize("Too many parameter", ERROR_COLOR)) + print(colorize(_("Too many parameter"), ERROR_COLOR)) if pars[1] in ui.relations: ui.unload(pars[1]) completer.remove_completion(pars[1]) else: - print(colorize("No such relation %s" % pars[1], ERROR_COLOR)) + print(colorize(_("No such relation %s") % pars[1], ERROR_COLOR)) elif command.startswith('SAVE '): pars = command.split(' ') if len(pars) != 3: - print(colorize("Missing parameter", ERROR_COLOR)) + print(colorize(_("Missing parameter"), ERROR_COLOR)) return filename = pars[1] @@ -318,9 +319,9 @@ def exec_query(command: str) -> None: def main(files=[]): - printtty(colorize('> ', PROMPT_COLOR) + "; Type HELP to get the HELP") + printtty(colorize('> ', PROMPT_COLOR) + _("; Type HELP to get the HELP")) printtty(colorize('> ', PROMPT_COLOR) + - "; Completion is activated using the tab (if supported by the terminal)") + _("; Completion is activated using the tab (if supported by the terminal)")) for i in files: load_relation(i, None) From 750f123620d88f87e337ab85cb1ddba53febf4a2 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Thu, 22 Oct 2020 08:18:23 +0200 Subject: [PATCH 09/14] Fix typo --- relational_readline/linegui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relational_readline/linegui.py b/relational_readline/linegui.py index 883e94b..38b8f80 100644 --- a/relational_readline/linegui.py +++ b/relational_readline/linegui.py @@ -140,7 +140,7 @@ def load_relation(filename: str, defname: Optional[str]) -> Optional[str]: ui.load(filename, defname) completer.add_completion(defname) - printtty(colorize(_('Loaded relation %s' % defname, COLOR_GREEN)) + printtty(colorize(_('Loaded relation %s') % defname, COLOR_GREEN)) return defname except Exception as e: print(colorize(str(e), ERROR_COLOR), file=sys.stderr) From 81cc446b90e6fb42888ff6468d00530aa52e68a5 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sat, 24 Oct 2020 18:23:59 +0200 Subject: [PATCH 10/14] Do not replace values before passing to gettext --- relational/parser.py | 12 ++++++------ relational/relation.py | 14 +++++++------- relational/rtypes.py | 2 +- relational_gui/creator.py | 2 +- relational_gui/guihandler.py | 2 +- relational_readline/linegui.py | 2 +- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/relational/parser.py b/relational/parser.py index 2bc1f26..98a1cf6 100644 --- a/relational/parser.py +++ b/relational/parser.py @@ -332,28 +332,28 @@ def parse_tokens(expression: List[Union[list, str]]) -> Node: if len(expression[:i]) == 0: raise ParserException( - _(f'Expected left operand for {expression[i]!r}')) + _('Expected left operand for %s') % repr(expression[i])) if len(expression[i + 1:]) == 0: raise ParserException( - _(f'Expected right operand for {expression[i]!r}')) + _('Expected right operand for %s') % repr(expression[i])) return Binary(expression[i], parse_tokens(expression[:i]), parse_tokens(expression[i + 1:])) # type: ignore '''Searches for unary operators, parsing from right to left''' for i in range(len(expression)): if expression[i] in u_operators: # Unary operator if len(expression) <= i + 2: raise ParserException( - _(f'Expected more tokens in {expression[i]!r}')) + _('Expected more tokens in %s') % repr(expression[i])) elif len(expression) > i + 3: raise ParserException( - _(f'Too many tokens in {expression[i]!r}')) + _('Too many tokens in %s') % repr(expression[i])) return Unary( expression[i], # type: ignore prop=expression[1 + i].strip(), # type: ignore child=parse_tokens(expression[2 + i]) # type: ignore ) - raise ParserException(_(f'Parse error on {expression!r}')) + raise ParserException(_('Parse error on %s') % repr(expression)) def _find_matching_parenthesis(expression: str, start=0, openpar='(', closepar=')') -> Optional[int]: @@ -423,7 +423,7 @@ def tokenize(expression: str) -> list: end = _find_matching_parenthesis(expression) if end is None: raise TokenizerException( - _(f'Missing matching \')\' in \'{expression}\'')) + _('Missing matching \')\' in \'%s\'') % expression) # Appends the tokenization of the content of the parenthesis items.append(tokenize(expression[1:end])) # Removes the entire parentesis and content from the expression diff --git a/relational/relation.py b/relational/relation.py index 10c4c4c..96bf0d7 100644 --- a/relational/relation.py +++ b/relational/relation.py @@ -89,7 +89,7 @@ class Relation: content = [] for row in loaded['content']: if len(row) != len(header): - raise ValueError(_(f'Line {row} contains an incorrect amount of values')) + raise ValueError(_('Line %d contains an incorrect amount of values') % row) t_row: Tuple[Optional[Union[int, float, str, Rdate]], ...] = load( row, Tuple[Optional[Union[int, float, str, Rdate]], ...], # type: ignore @@ -137,7 +137,7 @@ class Relation: for row in content: if len(row) != len(header): - raise ValueError(_(f'Line {row} contains an incorrect amount of values')) + raise ValueError(_('Line %d contains an incorrect amount of values') % row) r_content.append(row) # Guess types @@ -181,7 +181,7 @@ class Relation: try: c_expr = compile(expr, 'selection', 'eval') except: - raise Exception(_(f'Failed to compile expression: {expr}')) + raise Exception(_('Failed to compile expression: %s') % expr) content = [] for i in self.content: @@ -194,7 +194,7 @@ class Relation: if eval(c_expr, attributes): content.append(i) except Exception as e: - raise Exception(_(f'Failed to evaluate {expr} with {i}\n{e}')) + raise Exception(_('Failed to evaluate {expr} with {i}\n{e}').format(expr=expr, i=i, e=e)) return Relation(self.header, frozenset(content)) def product(self, other: 'Relation') -> 'Relation': @@ -473,7 +473,7 @@ class Header(tuple): for i in self: if not is_valid_relation_name(i): - raise Exception(_(f'"{i}" is not a valid attribute name')) + raise Exception(_('"%s" is not a valid attribute name') % i) if len(self) != len(set(self)): raise Exception('Attribute names must be unique') @@ -489,12 +489,12 @@ class Header(tuple): attrs = list(self) for old, new in params.items(): if not is_valid_relation_name(new): - raise Exception(_(f'{new} is not a valid attribute name')) + raise Exception(_('%s is not a valid attribute name') % new) try: id_ = attrs.index(old) attrs[id_] = new except: - raise Exception(_(f'Field not found: {old}')) + raise Exception(_('Field not found: %s') % old) return Header(attrs) def sharedAttributes(self, other: 'Header') -> int: diff --git a/relational/rtypes.py b/relational/rtypes.py index 69944a3..7281647 100644 --- a/relational/rtypes.py +++ b/relational/rtypes.py @@ -84,7 +84,7 @@ class Rdate: '''date: A string representing a date YYYY-MM-DD''' r = _date_regexp.match(date) if not r: - raise ValueError(_(f'{date} is not a valid date')) + raise ValueError(_('%s is not a valid date') % date) year = int(r.group(1)) month = int(r.group(3)) diff --git a/relational_gui/creator.py b/relational_gui/creator.py index d783c8b..437df0e 100644 --- a/relational_gui/creator.py +++ b/relational_gui/creator.py @@ -99,7 +99,7 @@ class creatorForm(QtWidgets.QDialog): try: hlist.append(self.table.item(i, j).text()) except: - QtWidgets.QMessageBox.information(None, _("Error"), _(f'Unset value in {i + 1},{j + 1}!')) + QtWidgets.QMessageBox.information(None, _("Error"), _('Unset value in %d,%d!') % (i + 1, j + 1)) return None content.append(hlist) return relation.Relation.create_from(header, content) diff --git a/relational_gui/guihandler.py b/relational_gui/guihandler.py index d8ba220..d3c4a9c 100644 --- a/relational_gui/guihandler.py +++ b/relational_gui/guihandler.py @@ -118,7 +118,7 @@ class relForm(QtWidgets.QMainWindow): if online is None: r = _('Network error') elif online > version: - r = _(f'New version available online: {online}.') + r = _('New version available online: %s.') % online elif online == version: r = _('Latest version installed.') else: diff --git a/relational_readline/linegui.py b/relational_readline/linegui.py index 38b8f80..7e945b3 100644 --- a/relational_readline/linegui.py +++ b/relational_readline/linegui.py @@ -123,7 +123,7 @@ def load_relation(filename: str, defname: Optional[str]) -> Optional[str]: ''' if not os.path.isfile(filename): print(colorize( - _(f'{filename} is not a file'), ERROR_COLOR), file=sys.stderr) + _('%s is not a file') % filename, ERROR_COLOR), file=sys.stderr) return None if defname is None: From 1848d7349849f983e8a6a99c18bebe13f40ffb00 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sat, 24 Oct 2020 18:25:01 +0200 Subject: [PATCH 11/14] Make makefile a bit more generic --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 24e5665..43a8bbf 100644 --- a/Makefile +++ b/Makefile @@ -102,10 +102,10 @@ po/messages.pot: relational.py relational/*.py relational_readline/*.py relation relational/*.py po/it.po: po/messages.pot - msgmerge --update po/it.po po/messages.pot + msgmerge --update $@ po/messages.pot po/it.mo: po/it.po - msgfmt po/it.po --output-file po/it.mo + msgfmt po/it.po --output-file $@ .PHONY: translations translations: po/it.mo From 569ad214416660a8dad5b3af2b5a0a806399f90f Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sat, 24 Oct 2020 19:15:22 +0200 Subject: [PATCH 12/14] pot file --- po/messages.pot | 632 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 630 insertions(+), 2 deletions(-) diff --git a/po/messages.pot b/po/messages.pot index 530abd9..cc8b512 100644 --- a/po/messages.pot +++ b/po/messages.pot @@ -8,13 +8,13 @@ msgid "" msgstr "" "Project-Id-Version: relational\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-21 08:13+0200\n" +"POT-Creation-Date: 2020-10-24 18:25+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #: relational.py:37 @@ -58,3 +58,631 @@ msgid "" "Module relational_readline is missing.\n" "Please install relational-cli package." msgstr "" + +#: relational_readline/linegui.py:126 +#, python-format +msgid "%s is not a file" +msgstr "" + +#: relational_readline/linegui.py:137 +#, python-format +msgid "%s is not a valid relation name" +msgstr "" + +#: relational_readline/linegui.py:143 +#, python-format +msgid "Loaded relation %s" +msgstr "" + +#: relational_readline/linegui.py:161 relational_gui/surveyForm.py:92 +msgid "Yeah, not sending that." +msgstr "" + +#: relational_readline/linegui.py:169 +msgid "" +"HELP [command]\n" +"\n" +"Comments are obtained starting with a ;\n" +"\n" +"To execute a query:\n" +"[relation =] query\n" +"\n" +"If the 1st part is omitted, the result will be stored in the relation " +"last_.\n" +"\n" +"To prevent from printing the relation, append a ; to the end of the query.\n" +"\n" +"To insert relational operators, type _OPNAME, they will be internally " +"replaced with the correct symbol.\n" +"\n" +"Rember: completion is enabled and can be very helpful if you can't remember " +"something." +msgstr "" + +#: relational_readline/linegui.py:188 +msgid "Quits the program" +msgstr "" + +#: relational_readline/linegui.py:189 +msgid "Lists the relations loaded" +msgstr "" + +#: relational_readline/linegui.py:190 +msgid "" +"LOAD filename [relationame]\n" +"Loads a relation into memory" +msgstr "" + +#: relational_readline/linegui.py:191 +msgid "" +"UNLOAD relationame\n" +"Unloads a relation from memory" +msgstr "" + +#: relational_readline/linegui.py:192 +msgid "" +"SAVE filename relationame\n" +"Saves a relation in a file" +msgstr "" + +#: relational_readline/linegui.py:193 +msgid "Prints the help on a command" +msgstr "" + +#: relational_readline/linegui.py:194 +msgid "Fill and send a survey" +msgstr "" + +#: relational_readline/linegui.py:196 +#, python-format +msgid "Unknown command: %s" +msgstr "" + +#: relational_readline/linegui.py:222 relational_readline/linegui.py:234 +#: relational_readline/linegui.py:245 +msgid "Missing parameter" +msgstr "" + +#: relational_readline/linegui.py:236 +msgid "Too many parameter" +msgstr "" + +#: relational_readline/linegui.py:241 +#, python-format +msgid "No such relation %s" +msgstr "" + +#: relational_readline/linegui.py:322 +msgid "; Type HELP to get the HELP" +msgstr "" + +#: relational_readline/linegui.py:324 +msgid "; Completion is activated using the tab (if supported by the terminal)" +msgstr "" + +#: relational_gui/creator.py:91 relational_gui/creator.py:102 +#: relational_gui/guihandler.py:283 relational_gui/guihandler.py:315 +#: relational_gui/guihandler.py:325 relational_gui/guihandler.py:342 +#: relational_gui/surveyForm.py:94 +msgid "Error" +msgstr "" + +#: relational_gui/creator.py:92 +msgid "Header error!" +msgstr "" + +#: relational_gui/creator.py:102 +#, python-format +msgid "Unset value in %d,%d!" +msgstr "" + +#: relational_gui/guihandler.py:119 +msgid "Network error" +msgstr "" + +#: relational_gui/guihandler.py:121 +#, python-format +msgid "New version available online: %s." +msgstr "" + +#: relational_gui/guihandler.py:123 +msgid "Latest version installed." +msgstr "" + +#: relational_gui/guihandler.py:125 +msgid "You are using an unstable version." +msgstr "" + +#: relational_gui/guihandler.py:127 +msgid "Version" +msgstr "" + +#: relational_gui/guihandler.py:241 +msgid "Empty relation" +msgstr "" + +#: relational_gui/guihandler.py:283 +msgid "Select a relation first." +msgstr "" + +#: relational_gui/guihandler.py:287 +msgid "Save Relation" +msgstr "" + +#: relational_gui/guihandler.py:289 +msgid "Json relations (*.json);;CSV relations (*.csv)" +msgstr "" + +#: relational_gui/guihandler.py:333 +msgid "New relation" +msgstr "" + +#: relational_gui/guihandler.py:334 +msgid "Insert the name for the new relation" +msgstr "" + +#: relational_gui/guihandler.py:342 +#, python-brace-format +msgid "Wrong name for destination relation: {name}." +msgstr "" + +#: relational_gui/guihandler.py:410 +msgid "Load Relation" +msgstr "" + +#: relational_gui/guihandler.py:412 +msgid "Relations (*.json *.csv);;Text Files (*.txt);;All Files (*)" +msgstr "" + +#: relational_gui/maingui.py:558 +msgid "Relational" +msgstr "" + +#: relational_gui/maingui.py:559 +msgid "result=query" +msgstr "" + +#: relational_gui/maingui.py:560 relational_gui/maingui.py:572 +msgid "⌫" +msgstr "" + +#: relational_gui/maingui.py:561 relational_gui/maingui.py:573 +msgid "Ctrl+Shift+Backspace" +msgstr "" + +#: relational_gui/maingui.py:562 relational_gui/maingui.py:574 +msgid "Execute" +msgstr "" + +#: relational_gui/maingui.py:563 relational_gui/maingui.py:575 +msgid "Ctrl+Return" +msgstr "" + +#: relational_gui/maingui.py:564 relational_gui/maingui.py:566 +msgid "Optimize" +msgstr "" + +#: relational_gui/maingui.py:565 relational_gui/maingui.py:568 +msgid "Undo optimize" +msgstr "" + +#: relational_gui/maingui.py:567 +msgid "Ctrl+Shift+O" +msgstr "" + +#: relational_gui/maingui.py:569 +msgid "Ctrl+Shift+U" +msgstr "" + +#: relational_gui/maingui.py:570 +msgid "Clear history" +msgstr "" + +#: relational_gui/maingui.py:571 +msgid "Ctrl+Shift+C" +msgstr "" + +#: relational_gui/maingui.py:576 +msgid "Processing…" +msgstr "" + +#: relational_gui/maingui.py:577 +msgid "&File" +msgstr "" + +#: relational_gui/maingui.py:578 +msgid "Help" +msgstr "" + +#: relational_gui/maingui.py:579 +msgid "Relations" +msgstr "" + +#: relational_gui/maingui.py:580 +msgid "Setti&ngs" +msgstr "" + +#: relational_gui/maingui.py:581 +msgid "Operators" +msgstr "" + +#: relational_gui/maingui.py:582 +msgid "Left outer join" +msgstr "" + +#: relational_gui/maingui.py:583 +msgid "Alt+J, Alt+L" +msgstr "" + +#: relational_gui/maingui.py:584 +msgid "Alt+A" +msgstr "" + +#: relational_gui/maingui.py:585 +msgid "Union" +msgstr "" + +#: relational_gui/maingui.py:586 +msgid "Alt+U" +msgstr "" + +#: relational_gui/maingui.py:587 +msgid "Difference" +msgstr "" + +#: relational_gui/maingui.py:588 +msgid "Rename" +msgstr "" + +#: relational_gui/maingui.py:589 +msgid "Alt+R" +msgstr "" + +#: relational_gui/maingui.py:590 +msgid "Division" +msgstr "" + +#: relational_gui/maingui.py:591 +msgid "Alt+D" +msgstr "" + +#: relational_gui/maingui.py:592 +msgid "Full outer join" +msgstr "" + +#: relational_gui/maingui.py:593 +msgid "Alt+J, Alt+O" +msgstr "" + +#: relational_gui/maingui.py:594 +msgid "Intersection" +msgstr "" + +#: relational_gui/maingui.py:595 +msgid "Alt+I" +msgstr "" + +#: relational_gui/maingui.py:596 +msgid "Product" +msgstr "" + +#: relational_gui/maingui.py:597 +msgid "Right outer join" +msgstr "" + +#: relational_gui/maingui.py:598 +msgid "Alt+J, Alt+R" +msgstr "" + +#: relational_gui/maingui.py:599 +msgid "Projection" +msgstr "" + +#: relational_gui/maingui.py:600 +msgid "Alt+P" +msgstr "" + +#: relational_gui/maingui.py:601 +msgid "Selection" +msgstr "" + +#: relational_gui/maingui.py:602 +msgid "Alt+S" +msgstr "" + +#: relational_gui/maingui.py:603 +msgid "Natural join" +msgstr "" + +#: relational_gui/maingui.py:604 +msgid "Alt+J, Alt+J" +msgstr "" + +#: relational_gui/maingui.py:605 +msgid "Attrib&utes" +msgstr "" + +#: relational_gui/maingui.py:606 +msgid "Re&lations" +msgstr "" + +#: relational_gui/maingui.py:608 +msgid "New" +msgstr "" + +#: relational_gui/maingui.py:609 relational_gui/rel_edit.py:66 +msgid "Edit" +msgstr "" + +#: relational_gui/maingui.py:610 +msgid "Load" +msgstr "" + +#: relational_gui/maingui.py:611 +msgid "Save" +msgstr "" + +#: relational_gui/maingui.py:612 +msgid "Unload all" +msgstr "" + +#: relational_gui/maingui.py:613 +msgid "Unload" +msgstr "" + +#: relational_gui/maingui.py:614 +msgid "Menu" +msgstr "" + +#: relational_gui/maingui.py:615 +msgid "About" +msgstr "" + +#: relational_gui/maingui.py:616 relational_gui/survey.py:124 +msgid "Survey" +msgstr "" + +#: relational_gui/maingui.py:617 +msgid "&About" +msgstr "" + +#: relational_gui/maingui.py:618 +msgid "&Load relation" +msgstr "" + +#: relational_gui/maingui.py:619 +msgid "Ctrl+O" +msgstr "" + +#: relational_gui/maingui.py:620 +msgid "&Save relation" +msgstr "" + +#: relational_gui/maingui.py:621 +msgid "Ctrl+S" +msgstr "" + +#: relational_gui/maingui.py:622 +msgid "&Quit" +msgstr "" + +#: relational_gui/maingui.py:623 +msgid "Ctrl+Q" +msgstr "" + +#: relational_gui/maingui.py:624 +msgid "&Check for new versions" +msgstr "" + +#: relational_gui/maingui.py:625 +msgid "&New relation" +msgstr "" + +#: relational_gui/maingui.py:626 +msgid "Ctrl+N" +msgstr "" + +#: relational_gui/maingui.py:627 +msgid "&Edit relation" +msgstr "" + +#: relational_gui/maingui.py:628 +msgid "Ctrl+E" +msgstr "" + +#: relational_gui/maingui.py:629 +msgid "&Unload relation" +msgstr "" + +#: relational_gui/maingui.py:630 +msgid "&Multi-line mode" +msgstr "" + +#: relational_gui/maingui.py:631 +msgid "Ctrl+L" +msgstr "" + +#: relational_gui/maingui.py:632 +msgid "Show history" +msgstr "" + +#: relational_gui/rel_edit.py:65 +msgid "Relation editor" +msgstr "" + +#: relational_gui/rel_edit.py:67 +msgid "Add tuple" +msgstr "" + +#: relational_gui/rel_edit.py:68 +msgid "Remove tuple" +msgstr "" + +#: relational_gui/rel_edit.py:69 +msgid "Add column" +msgstr "" + +#: relational_gui/rel_edit.py:70 +msgid "Remove column" +msgstr "" + +#: relational_gui/rel_edit.py:71 +msgid "" +"Remember that new relations and modified relations are not automatically " +"saved" +msgstr "" + +#: relational_gui/surveyForm.py:90 +msgid "Thanks" +msgstr "" + +#: relational_gui/surveyForm.py:90 +msgid "Thanks for sending!" +msgstr "" + +#: relational_gui/surveyForm.py:92 +msgid "Seriously?" +msgstr "" + +#: relational_gui/surveyForm.py:94 +msgid "Unable to send the data!" +msgstr "" + +#: relational_gui/survey.py:125 +msgid "Country" +msgstr "" + +#: relational_gui/survey.py:126 +msgid "School" +msgstr "" + +#: relational_gui/survey.py:127 +msgid "Age" +msgstr "" + +#: relational_gui/survey.py:128 +msgid "How did you find relational" +msgstr "" + +#: relational_gui/survey.py:129 +msgid "System" +msgstr "" + +#: relational_gui/survey.py:130 +msgid "Comments" +msgstr "" + +#: relational_gui/survey.py:131 +msgid "Email (only if you want a reply)" +msgstr "" + +#: relational_gui/survey.py:132 +msgid "Cancel" +msgstr "" + +#: relational_gui/survey.py:133 +msgid "Clear" +msgstr "" + +#: relational_gui/survey.py:134 +msgid "Send" +msgstr "" + +#: relational/maintenance.py:157 relational/maintenance.py:188 +msgid "Invalid name for destination relation" +msgstr "" + +#: relational/maintenance.py:230 +#, python-format +msgid "" +"Error in query: %s\n" +"%s" +msgstr "" + +#: relational/maintenance.py:235 +msgid "No query executed" +msgstr "" + +#: relational/parser.py:310 +msgid "Failed to parse empty expression" +msgstr "" + +#: relational/parser.py:335 +#, python-format +msgid "Expected left operand for %s" +msgstr "" + +#: relational/parser.py:339 +#, python-format +msgid "Expected right operand for %s" +msgstr "" + +#: relational/parser.py:346 +#, python-format +msgid "Expected more tokens in %s" +msgstr "" + +#: relational/parser.py:349 +#, python-format +msgid "Too many tokens in %s" +msgstr "" + +#: relational/parser.py:356 +#, python-format +msgid "Parse error on %s" +msgstr "" + +#: relational/parser.py:426 +#, python-format +msgid "Missing matching ')' in '%s'" +msgstr "" + +#: relational/relation.py:92 relational/relation.py:140 +#, python-format +msgid "Line %d contains an incorrect amount of values" +msgstr "" + +#: relational/relation.py:173 +#, python-format +msgid "Relations differ: [%s] [%s]" +msgstr "" + +#: relational/relation.py:184 +#, python-format +msgid "Failed to compile expression: %s" +msgstr "" + +#: relational/relation.py:197 +#, python-brace-format +msgid "" +"Failed to evaluate {expr} with {i}\n" +"{e}" +msgstr "" + +#: relational/relation.py:209 +msgid "Unable to perform product on relations with colliding attributes" +msgstr "" + +#: relational/relation.py:235 +msgid "Invalid attributes for projection" +msgstr "" + +#: relational/relation.py:476 +#, python-format +msgid "\"%s\" is not a valid attribute name" +msgstr "" + +#: relational/relation.py:492 +#, python-format +msgid "%s is not a valid attribute name" +msgstr "" + +#: relational/relation.py:497 +#, python-format +msgid "Field not found: %s" +msgstr "" + +#: relational/rtypes.py:87 +#, python-format +msgid "%s is not a valid date" +msgstr "" From ce39b2622440b1bc3049049ee6de54fccae47ba1 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sat, 24 Oct 2020 19:37:02 +0200 Subject: [PATCH 13/14] Italian translation --- po/it.po | 670 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 661 insertions(+), 9 deletions(-) diff --git a/po/it.po b/po/it.po index 917127a..08d3b0e 100644 --- a/po/it.po +++ b/po/it.po @@ -1,17 +1,18 @@ # Header entry was created by Lokalize. # -#: relational.py:37 # Salvo Tomaselli , 2020. msgid "" msgstr "" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Last-Translator: Salvo Tomaselli \n" -"PO-Revision-Date: 2020-10-21 08:20+0200\n" "Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2020-10-24 18:25+0200\n" +"PO-Revision-Date: 2020-10-24 19:36+0200\n" +"Last-Translator: Salvo Tomaselli \n" "Language-Team: Italian \n" "Language: it\n" "MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Lokalize 20.04.3\n" @@ -50,13 +51,664 @@ msgid "" "Module relational_gui is missing.\n" "Please install relational package or run make." msgstr "" -"Il modulo relational_gui manca. " -"Installare il pacchetto relational o eseguire make." +"Il modulo relational_gui manca. Installare il pacchetto relational o " +"eseguire make." #: relational.py:128 msgid "" "Module relational_readline is missing.\n" "Please install relational-cli package." msgstr "" -"Il modulo relational_readline manca. " -"Installare il pacchetto relational-cli." +"Il modulo relational_readline manca. Installare il pacchetto relational-cli." + +#: relational_readline/linegui.py:126 +#, python-format +msgid "%s is not a file" +msgstr "%s non è un file" + +#: relational_readline/linegui.py:137 +#, python-format +msgid "%s is not a valid relation name" +msgstr "%s non è un nome valido per una relazione" + +#: relational_readline/linegui.py:143 +#, python-format +msgid "Loaded relation %s" +msgstr "Relazione caricata %s" + +#: relational_readline/linegui.py:161 relational_gui/surveyForm.py:92 +msgid "Yeah, not sending that." +msgstr "Non manderò questo." + +#: relational_readline/linegui.py:169 +msgid "" +"HELP [command]\n" +"\n" +"Comments are obtained starting with a ;\n" +"\n" +"To execute a query:\n" +"[relation =] query\n" +"\n" +"If the 1st part is omitted, the result will be stored in the relation " +"last_.\n" +"\n" +"To prevent from printing the relation, append a ; to the end of the query.\n" +"\n" +"To insert relational operators, type _OPNAME, they will be internally " +"replaced with the correct symbol.\n" +"\n" +"Rember: completion is enabled and can be very helpful if you can't remember " +"something." +msgstr "" +"HELP [comando] " +"I commenti si ottengono iniziando una riga con ; " +"Per eseguire una query: " +"[relazione =] query " +"Se la prima parte è omessa, il risultato verrà salvato nella " +"relazione last_. " +"Per non stampare la relazione, aggiungere un ; alla fine della query. " +"Per inserire gli operatori relazionali, scrivere _NOMEOP, questi saranno " +"internamente sostituiti dal simbolo corretto. " +"Ricordare: Il completamento è abilitato e può essere utile se non si " +"ricorda qualcosa." + +#: relational_readline/linegui.py:188 +msgid "Quits the program" +msgstr "Termina il programma" + +#: relational_readline/linegui.py:189 +msgid "Lists the relations loaded" +msgstr "Elenca le relazioni caricate" + +#: relational_readline/linegui.py:190 +msgid "" +"LOAD filename [relationame]\n" +"Loads a relation into memory" +msgstr "" +"LOAD nomefile {nomerelazione} " +"Carica una relazione in memoria" + +#: relational_readline/linegui.py:191 +msgid "" +"UNLOAD relationame\n" +"Unloads a relation from memory" +msgstr "" +"UNLOAD nomerelazione " +"Rimuove una relazione dalla memoria" + +#: relational_readline/linegui.py:192 +msgid "" +"SAVE filename relationame\n" +"Saves a relation in a file" +msgstr "" +"SAVE nomefile nomerelazione " +"Salva la relazione in un file" + +#: relational_readline/linegui.py:193 +msgid "Prints the help on a command" +msgstr "Stampa la guida di un comando" + +#: relational_readline/linegui.py:194 +msgid "Fill and send a survey" +msgstr "Compila e invia un sondaggio" + +#: relational_readline/linegui.py:196 +#, python-format +msgid "Unknown command: %s" +msgstr "Comando sconosciuto: %s" + +#: relational_readline/linegui.py:222 relational_readline/linegui.py:234 +#: relational_readline/linegui.py:245 +msgid "Missing parameter" +msgstr "Parametro mancante" + +#: relational_readline/linegui.py:236 +msgid "Too many parameter" +msgstr "Troppi parametri" + +#: relational_readline/linegui.py:241 +#, python-format +msgid "No such relation %s" +msgstr "Nessuna relazione %s" + +#: relational_readline/linegui.py:322 +msgid "; Type HELP to get the HELP" +msgstr "; Scrivere HELP per leggere la guida" + +#: relational_readline/linegui.py:324 +msgid "; Completion is activated using the tab (if supported by the terminal)" +msgstr "" +"; Il completamento è attivato con il tasto tab (se il terminale lo supporta)" + +#: relational_gui/creator.py:91 relational_gui/creator.py:102 +#: relational_gui/guihandler.py:283 relational_gui/guihandler.py:315 +#: relational_gui/guihandler.py:325 relational_gui/guihandler.py:342 +#: relational_gui/surveyForm.py:94 +msgid "Error" +msgstr "Errore" + +#: relational_gui/creator.py:92 +msgid "Header error!" +msgstr "Errore nell'header!" + +#: relational_gui/creator.py:102 +#, python-format +msgid "Unset value in %d,%d!" +msgstr "Valore non impostato in %d,%d!" + +#: relational_gui/guihandler.py:119 +msgid "Network error" +msgstr "Errore di rete" + +#: relational_gui/guihandler.py:121 +#, python-format +msgid "New version available online: %s." +msgstr "Nuova versione disponibile online: %s." + +#: relational_gui/guihandler.py:123 +msgid "Latest version installed." +msgstr "Ultima versione installata." + +#: relational_gui/guihandler.py:125 +msgid "You are using an unstable version." +msgstr "Si sta usando una versione non stabile." + +#: relational_gui/guihandler.py:127 +msgid "Version" +msgstr "Versione" + +#: relational_gui/guihandler.py:241 +msgid "Empty relation" +msgstr "Relazione vuota" + +#: relational_gui/guihandler.py:283 +msgid "Select a relation first." +msgstr "Selezionare una relazione" + +#: relational_gui/guihandler.py:287 +msgid "Save Relation" +msgstr "Salva relazione" + +#: relational_gui/guihandler.py:289 +msgid "Json relations (*.json);;CSV relations (*.csv)" +msgstr "Relazioni json (*.json);;Relazioni CSV (*.csv)" + +#: relational_gui/guihandler.py:333 +msgid "New relation" +msgstr "Nuova relazione" + +#: relational_gui/guihandler.py:334 +msgid "Insert the name for the new relation" +msgstr "Inserire il nome per la nuova relazione" + +#: relational_gui/guihandler.py:342 +#, python-brace-format +msgid "Wrong name for destination relation: {name}." +msgstr "Nome errato per la relazione di destinazione: {name}." + +#: relational_gui/guihandler.py:410 +msgid "Load Relation" +msgstr "Apri relazione" + +#: relational_gui/guihandler.py:412 +msgid "Relations (*.json *.csv);;Text Files (*.txt);;All Files (*)" +msgstr "Relazioni (*.json *.csv);;File di testo (*.txt);;Tutti i file (*)" + +#: relational_gui/maingui.py:558 +msgid "Relational" +msgstr "Relational" + +#: relational_gui/maingui.py:559 +msgid "result=query" +msgstr "risultato=query" + +#: relational_gui/maingui.py:560 relational_gui/maingui.py:572 +msgid "⌫" +msgstr "" + +#: relational_gui/maingui.py:561 relational_gui/maingui.py:573 +msgid "Ctrl+Shift+Backspace" +msgstr "" + +#: relational_gui/maingui.py:562 relational_gui/maingui.py:574 +msgid "Execute" +msgstr "Esegui" + +#: relational_gui/maingui.py:563 relational_gui/maingui.py:575 +msgid "Ctrl+Return" +msgstr "" + +#: relational_gui/maingui.py:564 relational_gui/maingui.py:566 +msgid "Optimize" +msgstr "Ottimizza" + +#: relational_gui/maingui.py:565 relational_gui/maingui.py:568 +msgid "Undo optimize" +msgstr "Annulla ottimizza" + +#: relational_gui/maingui.py:567 +msgid "Ctrl+Shift+O" +msgstr "" + +#: relational_gui/maingui.py:569 +msgid "Ctrl+Shift+U" +msgstr "" + +#: relational_gui/maingui.py:570 +msgid "Clear history" +msgstr "Cancella cronologia" + +#: relational_gui/maingui.py:571 +msgid "Ctrl+Shift+C" +msgstr "" + +#: relational_gui/maingui.py:576 +msgid "Processing…" +msgstr "Calcolo..." + +#: relational_gui/maingui.py:577 +msgid "&File" +msgstr "&File" + +#: relational_gui/maingui.py:578 +msgid "Help" +msgstr "Aiuto" + +#: relational_gui/maingui.py:579 +msgid "Relations" +msgstr "Relazioni" + +#: relational_gui/maingui.py:580 +msgid "Setti&ngs" +msgstr "Impostazio&ni" + +#: relational_gui/maingui.py:581 +msgid "Operators" +msgstr "Operatori" + +#: relational_gui/maingui.py:582 +msgid "Left outer join" +msgstr "Join esterno sinistro" + +#: relational_gui/maingui.py:583 +msgid "Alt+J, Alt+L" +msgstr "" + +#: relational_gui/maingui.py:584 +msgid "Alt+A" +msgstr "" + +#: relational_gui/maingui.py:585 +msgid "Union" +msgstr "Unione" + +#: relational_gui/maingui.py:586 +msgid "Alt+U" +msgstr "" + +#: relational_gui/maingui.py:587 +msgid "Difference" +msgstr "Differenza" + +#: relational_gui/maingui.py:588 +msgid "Rename" +msgstr "Rinomina" + +#: relational_gui/maingui.py:589 +msgid "Alt+R" +msgstr "" + +#: relational_gui/maingui.py:590 +msgid "Division" +msgstr "Divisione" + +#: relational_gui/maingui.py:591 +msgid "Alt+D" +msgstr "" + +#: relational_gui/maingui.py:592 +msgid "Full outer join" +msgstr "Join esterno completo" + +#: relational_gui/maingui.py:593 +msgid "Alt+J, Alt+O" +msgstr "" + +#: relational_gui/maingui.py:594 +msgid "Intersection" +msgstr "Intersezione" + +#: relational_gui/maingui.py:595 +msgid "Alt+I" +msgstr "" + +#: relational_gui/maingui.py:596 +msgid "Product" +msgstr "Prodotto" + +#: relational_gui/maingui.py:597 +msgid "Right outer join" +msgstr "Join esterno destro" + +#: relational_gui/maingui.py:598 +msgid "Alt+J, Alt+R" +msgstr "" + +#: relational_gui/maingui.py:599 +msgid "Projection" +msgstr "Proiezione" + +#: relational_gui/maingui.py:600 +msgid "Alt+P" +msgstr "" + +#: relational_gui/maingui.py:601 +msgid "Selection" +msgstr "Selezione" + +#: relational_gui/maingui.py:602 +msgid "Alt+S" +msgstr "" + +#: relational_gui/maingui.py:603 +msgid "Natural join" +msgstr "Join naturale" + +#: relational_gui/maingui.py:604 +msgid "Alt+J, Alt+J" +msgstr "" + +#: relational_gui/maingui.py:605 +msgid "Attrib&utes" +msgstr "Attrib&uti" + +#: relational_gui/maingui.py:606 +msgid "Re&lations" +msgstr "Re&lazioni" + +#: relational_gui/maingui.py:608 +msgid "New" +msgstr "Nuova" + +#: relational_gui/maingui.py:609 relational_gui/rel_edit.py:66 +msgid "Edit" +msgstr "Modifica" + +#: relational_gui/maingui.py:610 +msgid "Load" +msgstr "Apri" + +#: relational_gui/maingui.py:611 +msgid "Save" +msgstr "Salva" + +#: relational_gui/maingui.py:612 +msgid "Unload all" +msgstr "Chiudi tutte" + +#: relational_gui/maingui.py:613 +msgid "Unload" +msgstr "Chiudi" + +#: relational_gui/maingui.py:614 +msgid "Menu" +msgstr "Menu" + +#: relational_gui/maingui.py:615 +msgid "About" +msgstr "Informazioni su Relational" + +#: relational_gui/maingui.py:616 relational_gui/survey.py:124 +msgid "Survey" +msgstr "Sondaggio" + +#: relational_gui/maingui.py:617 +msgid "&About" +msgstr "Informazioni su" + +#: relational_gui/maingui.py:618 +msgid "&Load relation" +msgstr "Apri re&lazione" + +#: relational_gui/maingui.py:619 +msgid "Ctrl+O" +msgstr "" + +#: relational_gui/maingui.py:620 +msgid "&Save relation" +msgstr "&Salva relazione" + +#: relational_gui/maingui.py:621 +msgid "Ctrl+S" +msgstr "" + +#: relational_gui/maingui.py:622 +msgid "&Quit" +msgstr "%Esci" + +#: relational_gui/maingui.py:623 +msgid "Ctrl+Q" +msgstr "" + +#: relational_gui/maingui.py:624 +msgid "&Check for new versions" +msgstr "&Controlla nuove versioni" + +#: relational_gui/maingui.py:625 +msgid "&New relation" +msgstr "&Nuova relazione" + +#: relational_gui/maingui.py:626 +msgid "Ctrl+N" +msgstr "" + +#: relational_gui/maingui.py:627 +msgid "&Edit relation" +msgstr "Modifica r&elazione" + +#: relational_gui/maingui.py:628 +msgid "Ctrl+E" +msgstr "" + +#: relational_gui/maingui.py:629 +msgid "&Unload relation" +msgstr "Chi&udi relazione" + +#: relational_gui/maingui.py:630 +msgid "&Multi-line mode" +msgstr "&Modalità multi riga" + +#: relational_gui/maingui.py:631 +msgid "Ctrl+L" +msgstr "" + +#: relational_gui/maingui.py:632 +msgid "Show history" +msgstr "Mostra cronologia" + +#: relational_gui/rel_edit.py:65 +msgid "Relation editor" +msgstr "Editor di relazioni" + +#: relational_gui/rel_edit.py:67 +msgid "Add tuple" +msgstr "Aggiungi tupla" + +#: relational_gui/rel_edit.py:68 +msgid "Remove tuple" +msgstr "Rimuovi tupla" + +#: relational_gui/rel_edit.py:69 +msgid "Add column" +msgstr "Aggiungi colonna" + +#: relational_gui/rel_edit.py:70 +msgid "Remove column" +msgstr "Rimuovi colonna" + +#: relational_gui/rel_edit.py:71 +msgid "" +"Remember that new relations and modified relations are not automatically " +"saved" +msgstr "" +"Ricorda che le relazioni nuove e modificate non sono salvate automaticamente" + +#: relational_gui/surveyForm.py:90 +msgid "Thanks" +msgstr "Grazie" + +#: relational_gui/surveyForm.py:90 +msgid "Thanks for sending!" +msgstr "Grazie per l'invio!" + +#: relational_gui/surveyForm.py:92 +msgid "Seriously?" +msgstr "Sul serio?" + +#: relational_gui/surveyForm.py:94 +msgid "Unable to send the data!" +msgstr "Impossibile inviare i dati" + +#: relational_gui/survey.py:125 +msgid "Country" +msgstr "Nazione" + +#: relational_gui/survey.py:126 +msgid "School" +msgstr "Scuola" + +#: relational_gui/survey.py:127 +msgid "Age" +msgstr "Età" + +#: relational_gui/survey.py:128 +msgid "How did you find relational" +msgstr "Come hai trovato Relational" + +#: relational_gui/survey.py:129 +msgid "System" +msgstr "Sistema" + +#: relational_gui/survey.py:130 +msgid "Comments" +msgstr "Commenti" + +#: relational_gui/survey.py:131 +msgid "Email (only if you want a reply)" +msgstr "Email (solo se si desidera una risposta)" + +#: relational_gui/survey.py:132 +msgid "Cancel" +msgstr "Annulla" + +#: relational_gui/survey.py:133 +msgid "Clear" +msgstr "Cancella" + +#: relational_gui/survey.py:134 +msgid "Send" +msgstr "Invia" + +#: relational/maintenance.py:157 relational/maintenance.py:188 +msgid "Invalid name for destination relation" +msgstr "Nome non valido per la relazione di destinazione" + +#: relational/maintenance.py:230 +#, python-format +msgid "" +"Error in query: %s\n" +"%s" +msgstr "" +"Errore nella query: %s " +"%s" + +#: relational/maintenance.py:235 +msgid "No query executed" +msgstr "Nessuna query eseguita" + +#: relational/parser.py:310 +msgid "Failed to parse empty expression" +msgstr "Espressione vuota" + +#: relational/parser.py:335 +#, python-format +msgid "Expected left operand for %s" +msgstr "Expected left operand for %s" + +#: relational/parser.py:339 +#, python-format +msgid "Expected right operand for %s" +msgstr "Atteso operatore destro per %s" + +#: relational/parser.py:346 +#, python-format +msgid "Expected more tokens in %s" +msgstr "Attesi più token in %s" + +#: relational/parser.py:349 +#, python-format +msgid "Too many tokens in %s" +msgstr "Troppi token in %s" + +#: relational/parser.py:356 +#, python-format +msgid "Parse error on %s" +msgstr "Errore di parsing in %s" + +#: relational/parser.py:426 +#, python-format +msgid "Missing matching ')' in '%s'" +msgstr "')' corrispondente mancante in '%s'" + +#: relational/relation.py:92 relational/relation.py:140 +#, python-format +msgid "Line %d contains an incorrect amount of values" +msgstr "La riga %d contiene un numero incorretto di valori" + +#: relational/relation.py:173 +#, python-format +msgid "Relations differ: [%s] [%s]" +msgstr "Le relazioni differiscono: [%s] [%s]" + +#: relational/relation.py:184 +#, python-format +msgid "Failed to compile expression: %s" +msgstr "Compilazione dell'espressione fallita: %s" + +#: relational/relation.py:197 +#, python-brace-format +msgid "" +"Failed to evaluate {expr} with {i}\n" +"{e}" +msgstr "" +"Impossibile valutare {expr} con {i} " +"{e}" + +#: relational/relation.py:209 +msgid "Unable to perform product on relations with colliding attributes" +msgstr "" +"Impossibile eseguire il prodotto su relazioni con attributi che collidono" + +#: relational/relation.py:235 +msgid "Invalid attributes for projection" +msgstr "Attributi invalidi per la proiezione" + +#: relational/relation.py:476 +#, python-format +msgid "\"%s\" is not a valid attribute name" +msgstr "\"%s\" non è un nome di attributo valido" + +#: relational/relation.py:492 +#, python-format +msgid "%s is not a valid attribute name" +msgstr "%s non è un nome di attributo valido" + +#: relational/relation.py:497 +#, python-format +msgid "Field not found: %s" +msgstr "File non trovato: %s" + +#: relational/rtypes.py:87 +#, python-format +msgid "%s is not a valid date" +msgstr "%s non è una data valida" From dc26b71cea9c66569767c34c6e5ef6f936dc1263 Mon Sep 17 00:00:00 2001 From: Salvo 'LtWorf' Tomaselli Date: Sat, 24 Oct 2020 19:40:30 +0200 Subject: [PATCH 14/14] typo --- po/it.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/po/it.po b/po/it.po index 08d3b0e..32e5528 100644 --- a/po/it.po +++ b/po/it.po @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-10-24 18:25+0200\n" -"PO-Revision-Date: 2020-10-24 19:36+0200\n" +"PO-Revision-Date: 2020-10-24 19:38+0200\n" "Last-Translator: Salvo Tomaselli \n" "Language-Team: Italian \n" "Language: it\n" @@ -484,7 +484,7 @@ msgstr "" #: relational_gui/maingui.py:622 msgid "&Quit" -msgstr "%Esci" +msgstr "&Esci" #: relational_gui/maingui.py:623 msgid "Ctrl+Q"