Skip to content

Commit

Permalink
Add first example de localized strings
Browse files Browse the repository at this point in the history
  • Loading branch information
HelioGuilherme66 committed Dec 26, 2023
1 parent fa9a893 commit 15869c4
Show file tree
Hide file tree
Showing 7 changed files with 404 additions and 51 deletions.
25 changes: 19 additions & 6 deletions src/robotide/application/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import builtins
import locale
import os
import wx
Expand Down Expand Up @@ -47,6 +48,10 @@
languages = None

locale.setlocale(locale.LC_ALL, 'C')
# add translation macro to builtin similar to what gettext does
# generated pot with: /usr/bin/python /usr/bin/pygettext.py -a -d RIDE -o RIDE.pot -p ./locale ../robotide
_ = wx.GetTranslation
builtins.__dict__['_'] = wx.GetTranslation

BACKGROUND_HELP = 'background help'
FOREGROUND_TEXT = 'foreground text'
Expand All @@ -62,7 +67,7 @@ def __init__(self):
class RIDE(wx.App):
_controller = None
_editor_provider = None
_initial_locale = None
_locale = None
_plugin_loader = None
editor = None
fileexplorerplugin = None
Expand All @@ -82,7 +87,7 @@ def __init__(self, path=None, updatecheck=True):
def OnInit(self): # Overrides wx method
# DEBUG To test RTL
# self._initial_locale = wx.Locale(wx.LANGUAGE_ARABIC)
self._initial_locale = wx.Locale(wx.LANGUAGE_ENGLISH_US)
self._locale = wx.Locale(wx.LANGUAGE_ENGLISH_US)
# Needed for SetToolTipString to work
wx.HelpProvider.Set(wx.SimpleHelpProvider()) # DEBUG: adjust to wx versions
self.settings = RideSettings()
Expand Down Expand Up @@ -307,9 +312,17 @@ def change_locale(self, message):
else:
code = wx.LANGUAGE_ENGLISH
print(f"DEBUG: application.py RIDE change_locale {language=}, {code=}")
del self._initial_locale
self._initial_locale = wx.Locale(code)
test = wx.GetTranslation('Application')
del self._locale
self._locale = wx.Locale(code)
if self._locale.IsOk():
wx.Locale.AddCatalogLookupPathPrefix('locale')
print("DEBUG: application.py RIDE change_locale locale OK add catalog\n")
cat = self._locale.AddCatalog('RIDE')
print(f"DEBUG: result of Add catalog={cat}")
else:
print("DEBUG: application.py RIDE change_locale locale NOT OK self._initial_locale = None")
self._locale = None
test = _('Application')
print(f"DEBUG: application.py RIDE change_locale translation of Application is {test}")

@staticmethod
Expand Down Expand Up @@ -359,7 +372,7 @@ def _find_robot_installation():
if robot_found:
system_encoding = get_system_encoding()
rf_file, rf_version = output.strip().split(b", ")
publish.RideLogMessage("Found Robot Framework version %s from %s." % (
publish.RideLogMessage(_("Found Robot Framework version %s from %s.") % (
str(rf_version, system_encoding), str(os.path.dirname(rf_file), system_encoding))).publish()
return rf_version
else:
Expand Down
1 change: 1 addition & 0 deletions src/robotide/application/locale
121 changes: 121 additions & 0 deletions src/robotide/locale/RIDE.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2023-12-26 03:18+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"


#: /home/helio/github/RIDE/src/robotide/application/application.py:374
msgid "Found Robot Framework version %s from %s."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:48
msgid ""
"\n"
"[File]\n"
"!&New Project | Create a new top level suite | Ctrlcmd-N | ART_NEW\n"
"---\n"
"!&Open Test Suite | Open file containing tests | Ctrlcmd-O | ART_FILE_OPEN\n"
"!Open &Directory | Open directory containing datafiles | Shift-Ctrlcmd-O | ART_FOLDER_OPEN\n"
"!Open External File | Open file in Code Editor | | ART_NORMAL_FILE\n"
"---\n"
"!&Save | Save selected datafile | Ctrlcmd-S | ART_FILE_SAVE\n"
"!Save &All | Save all changes | Ctrlcmd-Shift-S | ART_FILE_SAVE_AS\n"
"---\n"
"!E&xit | Exit RIDE | Ctrlcmd-Q\n"
"\n"
"[Tools]\n"
"!Search Unused Keywords | | | | POSITION-54\n"
"!Manage Plugins | | | | POSITION-81\n"
"!View All Tags | | F7 | | POSITION-82\n"
"!Preferences | | | | POSITION-99\n"
"\n"
"[Help]\n"
"!Shortcut keys | RIDE shortcut keys\n"
"!User Guide | Robot Framework User Guide\n"
"!Wiki | RIDE User Guide (Wiki)\n"
"!Report a Problem | Open browser to SEARCH on the RIDE issue tracker\n"
"!Release notes | Shows release notes\n"
"!About | Information about RIDE\n"
"!Check for Upgrade | Looks at PyPi for new released version\n"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:140
msgid "Saved %s"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:141
msgid "Saved all files"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:164
msgid "Validation Error"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:168
msgid "\"%s\" is read only"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:169
msgid "Modification prevented"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:321
msgid ""
"There are unsaved modifications.\n"
"Do you want to save your changes before exiting?"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:323
#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:413
msgid "Warning"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:411
msgid ""
"There are unsaved modifications.\n"
"Do you want to proceed without saving?"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:447
msgid "Choose a directory containing Robot files"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:512
msgid "RIDE - Preferences"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:599
msgid "Workspace modifications detected on the file system."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:600
msgid "Do you want to reload the workspace?"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:601
msgid "Answering <No> will ignore the changes on disk."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:603
msgid "Answering <Yes> will discard unsaved changes."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:604
msgid "Files Changed On Disk"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:766
msgid "Shortcut keys for RIDE"
msgstr ""

Binary file added src/robotide/locale/pt/LC_MESSAGES/RIDE.mo
Binary file not shown.
148 changes: 148 additions & 0 deletions src/robotide/locale/pt/LC_MESSAGES/RIDE.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR ORGANIZATION
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: RIDE 2.1\n"
"POT-Creation-Date: 2023-12-26 03:18+0000\n"
"PO-Revision-Date: 2023-12-26 03:39+0000\n"
"Last-Translator: Hélio Guilherme <[email protected]>\n"
"Language-Team: [email protected]\n"
"Language: pt\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: pygettext.py 1.5\n"
"X-Generator: Poedit 3.4.1\n"

#: /home/helio/github/RIDE/src/robotide/application/application.py:374
msgid "Found Robot Framework version %s from %s."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:48
msgid ""
"\n"
"[File]\n"
"!&New Project | Create a new top level suite | Ctrlcmd-N | ART_NEW\n"
"---\n"
"!&Open Test Suite | Open file containing tests | Ctrlcmd-O | ART_FILE_OPEN\n"
"!Open &Directory | Open directory containing datafiles | Shift-Ctrlcmd-O | ART_FOLDER_OPEN\n"
"!Open External File | Open file in Code Editor | | ART_NORMAL_FILE\n"
"---\n"
"!&Save | Save selected datafile | Ctrlcmd-S | ART_FILE_SAVE\n"
"!Save &All | Save all changes | Ctrlcmd-Shift-S | ART_FILE_SAVE_AS\n"
"---\n"
"!E&xit | Exit RIDE | Ctrlcmd-Q\n"
"\n"
"[Tools]\n"
"!Search Unused Keywords | | | | POSITION-54\n"
"!Manage Plugins | | | | POSITION-81\n"
"!View All Tags | | F7 | | POSITION-82\n"
"!Preferences | | | | POSITION-99\n"
"\n"
"[Help]\n"
"!Shortcut keys | RIDE shortcut keys\n"
"!User Guide | Robot Framework User Guide\n"
"!Wiki | RIDE User Guide (Wiki)\n"
"!Report a Problem | Open browser to SEARCH on the RIDE issue tracker\n"
"!Release notes | Shows release notes\n"
"!About | Information about RIDE\n"
"!Check for Upgrade | Looks at PyPi for new released version\n"
msgstr ""
"\n"
"[Ficheiro]\n"
"!&New Project | Create a new top level suite | Ctrlcmd-N | ART_NEW\n"
"---\n"
"!&Open Test Suite | Open file containing tests | Ctrlcmd-O | ART_FILE_OPEN\n"
"!Open &Directory | Open directory containing datafiles | Shift-Ctrlcmd-O | ART_FOLDER_OPEN\n"
"!Open External File | Open file in Code Editor | | ART_NORMAL_FILE\n"
"---\n"
"!&Save | Save selected datafile | Ctrlcmd-S | ART_FILE_SAVE\n"
"!Save &All | Save all changes | Ctrlcmd-Shift-S | ART_FILE_SAVE_AS\n"
"---\n"
"!E&xit | Exit RIDE | Ctrlcmd-Q\n"
"\n"
"[Tools]\n"
"!Search Unused Keywords | | | | POSITION-54\n"
"!Manage Plugins | | | | POSITION-81\n"
"!View All Tags | | F7 | | POSITION-82\n"
"!Preferences | | | | POSITION-99\n"
"\n"
"[Help]\n"
"!Shortcut keys | RIDE shortcut keys\n"
"!User Guide | Robot Framework User Guide\n"
"!Wiki | RIDE User Guide (Wiki)\n"
"!Report a Problem | Open browser to SEARCH on the RIDE issue tracker\n"
"!Release notes | Shows release notes\n"
"!About | Information about RIDE\n"
"!Check for Upgrade | Looks at PyPi for new released version\n"

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:140
msgid "Saved %s"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:141
msgid "Saved all files"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:164
msgid "Validation Error"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:168
msgid "\"%s\" is read only"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:169
msgid "Modification prevented"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:321
msgid ""
"There are unsaved modifications.\n"
"Do you want to save your changes before exiting?"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:323
#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:413
msgid "Warning"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:411
msgid ""
"There are unsaved modifications.\n"
"Do you want to proceed without saving?"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:447
msgid "Choose a directory containing Robot files"
msgstr "Escolha uma diretoria contendo ficheiros Robot"

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:512
msgid "RIDE - Preferences"
msgstr "RIDE - Preferências"

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:599
msgid "Workspace modifications detected on the file system."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:600
msgid "Do you want to reload the workspace?"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:601
msgid "Answering <No> will ignore the changes on disk."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:603
msgid "Answering <Yes> will discard unsaved changes."
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:604
msgid "Files Changed On Disk"
msgstr ""

#: /home/helio/github/RIDE/src/robotide/ui/mainframe.py:766
msgid "Shortcut keys for RIDE"
msgstr ""
Loading

0 comments on commit 15869c4

Please sign in to comment.