Commit Graph
165 Commits
Author SHA1 Message Date
David Sangrey 1425432abd [#2615] Prevent Linux NONE Toml Config Crash 2026-05-28 21:37:05 -04:00
David Sangrey 29339c09b3 [#2642] Update Inara Link 2026-05-28 21:24:44 -04:00
Giampiero L. 2092fa4986 Add authentication success localization
Add two new localization entries to L10n/en.template for companion.py: a messagebox title "Authentication Successful" and a cAPI success body "Authentication with cAPI Successful.{CR}You may now close the Frontier login tab if it is still open." to display after successful authentication.
2026-02-15 01:12:25 +01:00
David Sangrey abe5f54be1 Refactor Companion 2026-01-04 19:19:07 -05:00
David Sangrey f69a45584f Linter Fixes from #2553 2026-01-02 22:42:39 -05:00
David Sangrey 0e19058d29 Add Translations, Plugin Ver Check 2025-12-27 18:16:57 -05:00
Inutt 9fd04e5c02 Add localisation of stations names
This currently only affects system colonisation ships, which have '$EXT_PANEL_ColonisationShip;' in their StationName
entries in the journal. Other strings may need to be added in future.

Fixes #2404
diff --git a/L10n/en.template b/L10n/en.template
index faac3259..f670e39c 100644
--- a/L10n/en.template
+++ b/L10n/en.template
@@ -839,3 +839,9 @@

 /* edastro_core.py: Settings>EDAstro - Label on checkbox for 'send data'; */
 "Send data to EDAstro" = "Send data to EDAstro";
+
+/* common_coreutils.py: Colonisation ship name, with title; In files: common_coreutils.py:81:81 */
+"System Colonisation Ship {NAME}" = "System Colonisation Ship {NAME}";
+
+/* common_coreutils.py: Unidentified colonisation ship; In files: common_coreutils.py:84:84 */
+"System Colonisation Ship" = "System Colonisation Ship";
diff --git a/plugins/common_coreutils.py b/plugins/common_coreutils.py
index 6b90d4dc..a488de46 100644
--- a/plugins/common_coreutils.py
+++ b/plugins/common_coreutils.py
@@ -29,6 +29,7 @@ import gzip
 import io
 import json
 import os
+import re
 import myNotebook as nb  # noqa: N813
 from EDMCLogging import get_main_logger
 from companion import CAPIData
@@ -47,6 +48,49 @@ SEPY = 10  # seperator line spacing
 STATION_UNDOCKED = '×'  # "Station" name to display when not docked = U+00D7

+# Known colonisation ship names match one of the following:
+#   "$EXT_PANEL_ColonisationShip;"
+#   "$EXT_PANEL_ColonisationShip; <ship name>" with "<ship name>" being eg; "Okawara Horizons"
+#   "$EXT_PANEL_ColonisationShip:#index=<number>;"
+#   "$EXT_PANEL_ColonisationShip:#index=<number>; <ship name>"
+_RE_COLONISATION_SHIP = re.compile(r'\$EXT_PANEL_ColonisationShip(?::#index=(\d+))?;(?: (.+))?')
+
+
+def localised_name(value: str | None) -> str | None:
+    """
+    Handle localisation of strings in places like station names.
+
+    This is currently an issue for system colonisation ships that have a station name along the
+    lines of "$EXT_PANEL_ColonisationShip; Okawara Horizons" when written to the journal, but would
+    be better displayed as "System Colonisation Ship Okawara Horizona" (or other appropriately
+    localised equivalent).
+
+    If no (known) localisable strings are present, the input will be returned unmodified.
+
+    :param value: The non-localised string.
+    :return: The localised string, or None if the input was None.
+    """
+    if value is None:
+        return None
+
+    colonisation_ship_match = _RE_COLONISATION_SHIP.match(value)
+    if colonisation_ship_match:
+        ship_index = colonisation_ship_match.group(1)
+        ship_name = colonisation_ship_match.group(2)
+        # Use the ship's index as its name if no name was provided.
+        ship_id = ship_name or ship_index
+
+        if ship_id:
+            # LANG: Colonisation ship name, with title
+            value = tr.tl("System Colonisation Ship {NAME}").format(NAME=ship_id)
+
+        else:
+            # LANG: Unidentified colonisation ship
+            value = tr.tl("System Colonisation Ship")
+
+    return value
+
+
 def plugin_start3(plugin_dir: str) -> str:
     """
     Start the plugin.
@@ -121,7 +165,7 @@ def station_link_common(data: CAPIData, this):
     :param this: The module global from the calling module.
     """
     if data['commander']['docked'] or this.on_foot and this.station_name:
-        this.station_link['text'] = this.station_name
+        this.station_link['text'] = localised_name(this.station_name)
     elif data['lastStarport']['name'] and data['lastStarport']['name'] != "":
         this.station_link['text'] = STATION_UNDOCKED
     else:
@@ -163,12 +207,14 @@ def station_name_setter_common(this):
     :param this: The module global from the calling module.
     """
     to_set: str = cast(str, this.station_name)
+
     if not to_set:
         if this.system_population is not None and this.system_population > 0:
             to_set = STATION_UNDOCKED
         else:
             to_set = ''

+    to_set = str(localised_name(to_set))
     this.station_link['text'] = to_set

diff --git a/plugins/edsm.py b/plugins/edsm.py
index e1e6b168..902e248b 100644
--- a/plugins/edsm.py
+++ b/plugins/edsm.py
@@ -43,7 +43,7 @@ from ttkHyperlinkLabel import HyperlinkLabel
 from l10n import translations as tr
 from plugins.common_coreutils import (api_keys_label_common, PADX, PADY, BUTTONX, SEPY, BOXY, STATION_UNDOCKED,
                                       show_pwd_var_common, station_link_common, this_format_common,
-                                      cmdr_data_initial_common)
+                                      cmdr_data_initial_common, localised_name)

 # TODO:
@@ -543,7 +543,7 @@ entry: {entry!r}'''
                 to_set = ''

         if this.station_link:
-            this.station_link['text'] = to_set
+            this.station_link['text'] = localised_name(to_set)
             this.station_link['url'] = station_url(str(this.system_name), str(this.station_name))
             this.station_link.update_idletasks()
2025-11-29 01:25:19 +00:00
David Sangrey ca243b775f [#261] Enable Plugin Enable/Disable System
This does rely on plugins respecting a stop call.
2025-11-17 19:12:12 -05:00
David Sangrey 715553207f [#2430] First-Pass EDAstro Core Plugin 2025-11-09 18:00:50 -05:00
David Sangrey f63774ebc6 [#1318] Update Lagging Message 2025-05-03 20:12:10 -04:00
David Sangrey eae0417797 [#1346] Option to Disable Systray 2025-04-22 22:48:31 -04:00
David Sangrey 9ddf7aa28a Merge pull request #2267 from HullSeals/enhancement/748/change-plugin-dir
[748] Allow Custom Plugins Directory
2024-07-21 23:32:33 -04:00
David Sangrey fee05d3aa5 [748] Enable Automatic Restart 2024-06-25 12:01:29 -04:00
David Sangrey 86b5556efb [748] Enable Plugin Change w/ App Restart 2024-06-25 11:25:05 -04:00
David Sangrey 067bef628e [2262] Update Capitalizations and add Translations 2024-06-23 13:14:41 -04:00
David Sangrey d4960efa8c [Lang] Update Translations
Also corrects fleetcarrier to proper Fleet Carrier
2024-06-03 16:44:18 -04:00
David Sangrey 8a27ca266d [Minor] Add Translation 2024-05-28 09:02:58 -04:00
David Sangrey ce45e5cd34 Merge branch 'develop' into enhancement/519/add-beta 2024-05-24 18:43:59 -04:00
David Sangrey f6d7100f24 [Fix] Update Translations, Fix Menu Creation, Fix Alt URL 2024-05-21 16:54:49 -04:00
David Sangrey 148c853b1e *Grumble Grumble* 2024-05-14 23:04:16 -04:00
David Sangrey 68fac14c67 [Translations] Update Translations 2024-05-14 20:13:49 -04:00
David Sangrey 264d359a29 Merge branch 'develop' into enhancement/519/add-beta 2024-05-14 18:00:36 -04:00
Phoebe f7350fb46d Merge pull request #2214 from HullSeals/enhancement/1801/FDEV-ID-Updater
[1801] FDEV ID Local Updater
2024-05-14 23:22:20 +02:00
David Sangrey 2686b23b3b Merge branch 'develop' into enhancement/1801/FDEV-ID-Updater 2024-05-13 20:21:42 -04:00
David Sangrey 99a0cc9eea Merge branch 'develop' into enhancement/806/system-profiler 2024-05-13 20:20:44 -04:00
David Sangrey 1e1ab64b1a Merge branch 'develop' into enhancement/519/add-beta 2024-05-13 20:13:45 -04:00
Phoebe 95fa67ca86 Merge pull request #2210 from HullSeals/enhancement/1173/right-click-provider-options
[1173] Add Right-Click Menu to UI Elements
2024-05-14 01:48:54 +02:00
David Sangrey 1d052e4930 [519] Add Downgrade Warning 2024-05-05 18:17:00 -04:00
David Sangrey ce2e20639c [806] Add Translation 2024-05-01 20:00:59 -04:00
David Sangrey af207f60e8 [1801] FDEV ID Local Updater
This removes the FDEV ID Submodule, and instead hands over responsibility for maintaining the fdev id files to the internal system updater. Instead of the full submodule, we only pull the two files we need.
2024-04-27 20:10:09 -04:00
David Sangrey 770c0ed3a5 [2203] Catch Irrecoverable Errors 2024-04-26 00:41:58 -04:00
David Sangrey c8f2b6018c [1173] Right-Click Provider Options 2024-04-24 20:03:04 -04:00
David Sangrey ccb103242c Merge branch 'develop' into enhancement/2186/remove-darwin 2024-04-05 17:17:51 -04:00
David Sangrey 572f724a71 [1471] Add PIL to Improve Clipboard 2024-03-28 12:59:22 -04:00
David Sangrey cfb6f729ab [2186] Remove Unused Translations 2024-03-27 21:27:22 -04:00
David Sangrey 6da7597e79 [Lang] Add Language Check 2024-03-23 10:27:01 -04:00
Phoebe 41b789c5d2 Update en.template 2024-02-25 12:27:07 +01:00
David Sangrey e5172e0486 [#2077] Ensure Valid Providers on Boot
Ensure we have valid providers set, and throw a warning dialog if we don't.
2024-02-08 13:10:16 -05:00
David Sangrey 881c94a619 [Lang] Update Lang Comment 2024-01-04 15:22:57 -05:00
David Sangrey 41b879716f [2140] Translate Newver Str 2024-01-04 15:22:50 -05:00
David Sangrey fe327606ab [1801] Add Warning for FDevIDs 2023-12-15 11:51:53 -05:00
David Sangrey dac9542557 [Minor] Correct Template S&G
Also includes a minor fix for try/except if coriolis-data is missing
2023-12-13 19:38:42 -05:00
Phoebe 34d91dfb2d [Enhancement] Broken Plugins Popup
- Adds a Popup at startup about Plugins that failed to load.
- Adds entry about broken Plugins in the Settings - Plugins tab.
- Adds corresponding translation entries.
2023-12-14 01:06:09 +01:00
David Sangrey 761e9f0f59 [Translations] Update Translation Files 2023-12-13 17:27:33 -05:00
David Sangrey c511b51003 [Translations] Update Translation Template 2023-12-06 17:41:22 -05:00
David Sangrey 3563084f67 #2031 Remove more references to EDDB 2023-07-22 20:54:32 -04:00
Athanasius 5daabc57ef translations: Updated l10n/en.template via script 2023-01-04 15:08:55 +00:00
Athanasius fe38367e19 Translations: Update en.template with latest script output
Yes, we're just trusting it this time.
2023-01-03 11:48:18 +00:00
Athanasius 4b31b67042 CAPI: Only perform queries for Live galaxy.
* This is *temporary* pending properly implementing utilising the Legacy
  CAPI host.
* Check in the EDMarketConnector.EDApp.capi_request_data() function *and*
  also in some companion.session functions.  But not absolutely all possible
  entry points because we'll be undoing it when we implement Legacy support.

This *is* sufficient for the current core code entry points.  If any plugin
is invoking its own CAPI requests, well it shouldn't be.
2022-12-01 16:42:04 +00:00
Athanasius a944eaf445 translations: Add new inara.py string about Live data only 2022-11-27 16:49:45 +00:00