Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion NetworkMgr/net_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_ssid(wificard):
shell=True, stdout=PIPE, universal_newlines=True)
# If there are quotation marks in the string, use that as a separator,
# otherwise use the default whitespace. This is to handle ssid strings
# with spaces in them. These ssid strings will be double quoted by ifconfig
# with spaces in them. These ssid strings will be double-quoted by ifconfig
temp = wlan.stdout.readlines()[0].rstrip()
if '"' in temp:
out = temp.split('"')[1]
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ Users of NetworkMgr must be members of the _wheel_ group. To add a user:

If the desktop environment supports XDG then you can simply log out, or restart the computer. NetworkMgr should start automatically at login time.

## For Development dicussion
## Managing Translations
To create a translation file.
```shell
./setup.py create_translation --locale=fr
```

## For Development discussion

You can join us at [#networkmgr](irc://irc.libera.chat:6697/networkmgr) on irc.libera.chat:6697
113 changes: 113 additions & 0 deletions po/networkmgr.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-29 15:54+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"

#: src/trayicon.py:67
msgid "Ethernet Network"
msgstr ""

#: src/trayicon.py:78
#, python-format
msgid "Wired %s Connected"
msgstr ""

#: src/trayicon.py:81
msgid "Disable"
msgstr ""

#: src/trayicon.py:86
#, python-format
msgid "Wired %s Disconnected"
msgstr ""

#: src/trayicon.py:89
msgid "Enable"
msgstr ""

#: src/trayicon.py:93
#, python-format
msgid "Wired %s Unplug"
msgstr ""

#: src/trayicon.py:101
#, python-format
msgid "WiFi %s Disabled"
msgstr ""

#: src/trayicon.py:104
#, python-format
msgid "Enable Wifi %s"
msgstr ""

#: src/trayicon.py:109
#, python-format
msgid "WiFi %s Disconnected"
msgstr ""

#: src/trayicon.py:113 src/trayicon.py:131
#, python-format
msgid "Disable Wifi %s"
msgstr ""

#: src/trayicon.py:119
#, python-format
msgid "WiFi %s Connected"
msgstr ""

#: src/trayicon.py:125
#, python-format
msgid "Disconnect from %s"
msgstr ""

#: src/trayicon.py:139
msgid "Enable Networking"
msgstr ""

#: src/trayicon.py:143
msgid "Disable Networking"
msgstr ""

#: src/trayicon.py:148
msgid "Close Network Manager"
msgstr ""

#: src/trayicon.py:156
msgid "Available Connections"
msgstr ""

#: src/trayicon.py:364
msgid "Wi-Fi Network Authentication Required"
msgstr ""

#: src/trayicon.py:376
#, python-brace-format
msgid "{ssid_info[0]} Wi-Fi Network Authentication failed"
msgstr ""

#: src/trayicon.py:378
#, python-brace-format
msgid "Authentication required by {ssid_info[0]} Wi-Fi Network"
msgstr ""

#: src/trayicon.py:381
msgid "Password:"
msgstr ""

#: src/trayicon.py:384
msgid "Show password"
msgstr ""
113 changes: 113 additions & 0 deletions po/pt_Br.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Portuguese translations for PACKAGE package.
# Copyright (C) 2025 THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# Edu_Amr <ghost.radiation065@silomails.com>, 2025.
#
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-08-29 15:54+0800\n"
"PO-Revision-Date: 2025-01-05 16:17-0400\n"
"Last-Translator: Edu_Amr <ghost.radiation065@silomails.com>\n"
"Language-Team: Portuguese <translation-team-pt@lists.sourceforge.net>\n"
"Language: pt_Br\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: src/trayicon.py:67
msgid "Ethernet Network"
msgstr "Rede Ethernet"

#: src/trayicon.py:78
#, python-format
msgid "Wired %s Connected"
msgstr "Cabo %s Conectado"

#: src/trayicon.py:81
msgid "Disable"
msgstr "Desativar"

#: src/trayicon.py:86
#, python-format
msgid "Wired %s Disconnected"
msgstr "Cabo %s Desconectado"

#: src/trayicon.py:89
msgid "Enable"
msgstr "Ativar"

#: src/trayicon.py:93
#, python-format
msgid "Wired %s Unplug"
msgstr "Cabo %s Desconectado fisicamente"

#: src/trayicon.py:101
#, python-format
msgid "WiFi %s Disabled"
msgstr "Wi-Fi %s Desativado"

#: src/trayicon.py:104
#, python-format
msgid "Enable Wifi %s"
msgstr "Ativar Wi-Fi %s"

#: src/trayicon.py:109
#, python-format
msgid "WiFi %s Disconnected"
msgstr "Wi-Fi %s Desconectado"

#: src/trayicon.py:113 src/trayicon.py:131
#, python-format
msgid "Disable Wifi %s"
msgstr "Desativar Wi-Fi %s"

#: src/trayicon.py:119
#, python-format
msgid "WiFi %s Connected"
msgstr "Wi-Fi %s Conectado"

#: src/trayicon.py:125
#, python-format
msgid "Disconnect from %s"
msgstr "Desconectar de %s"

#: src/trayicon.py:139
msgid "Enable Networking"
msgstr "Ativar Rede"

#: src/trayicon.py:143
msgid "Disable Networking"
msgstr "Desativar Rede"

#: src/trayicon.py:148
msgid "Close Network Manager"
msgstr "Fechar Gerenciador de Rede"

#: src/trayicon.py:156
msgid "Available Connections"
msgstr "Conexões Disponíveis"

#: src/trayicon.py:364
msgid "Wi-Fi Network Authentication Required"
msgstr "Autenticação Necessária para a Rede Wi-Fi"

#: src/trayicon.py:376
#, python-brace-format
msgid "{ssid_info[0]} Wi-Fi Network Authentication failed"
msgstr "Autenticação falhou na rede Wi-Fi {ssid_info[0]}"

#: src/trayicon.py:378
#, python-brace-format
msgid "Authentication required by {ssid_info[0]} Wi-Fi Network"
msgstr "Autenticação requerida pela rede Wi-Fi {ssid_info[0]}"

#: src/trayicon.py:381
msgid "Password:"
msgstr "Senha:"

#: src/trayicon.py:384
msgid "Show password"
msgstr "Mostrar senha"
70 changes: 65 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@
import os
import sys
from platform import system
from setuptools import setup
from subprocess import run

from setuptools import setup, Command, glob

__VERSION__ = '6.5'
PROGRAM_VERSION = __VERSION__

prefix = '/usr/local' if system() == 'FreeBSD' else sys.prefix

# compiling translations
os.system("sh compile_translations.sh")


def datafilelist(installbase, sourcebase):
datafileList = []
Expand All @@ -25,6 +23,64 @@ def datafilelist(installbase, sourcebase):
datafileList.append((root.replace(sourcebase, installbase), fileList))
return datafileList

class UpdateTranslationsCommand(Command):
"""Custom command to extract messages and update .po files."""

description = 'Extract messages to .pot and update .po'
user_options = [] # No custom options

def initialize_options(self):
pass

def finalize_options(self):
pass

def run(self):
# Define paths
pot_file = 'po/networkmgr.pot'
po_files = glob.glob('po/*.po')
# Step 1: Extract messages to .pot file
print("Extracting messages to .pot file...")
os.system(f'xgettext --from-code=UTF-8 -L Python -o {pot_file} networkmgr/*.py networkmgr')
# Step 2: Update .po files with the new .pot file
print("Updating .po files with new translations...")
for po_file in po_files:
print(f"Updating {po_file}...")
os.system(f'msgmerge -U {po_file} {pot_file}')
print("Translation update complete.")

class CreateTranslationCommand(Command):
"""Custom command to create a new .po file for a specific language."""
locale = None
description = 'Create a new .po file for the specified language'
user_options = [
('locale=', 'l', 'Locale code for the new translation (e.g., fr, es)')
]

def initialize_options(self):
self.locale = None # Initialize the locale option to None

def finalize_options(self):
if self.locale is None:
raise Exception("You must specify the locale code (e.g., --locale=fr)")

def run(self):
# Define paths
pot_file = 'po/networkmgr.pot'
po_dir = 'po'
po_file = os.path.join(po_dir, f'{self.locale}.po')
# Check if the .pot file exists
if not os.path.exists(pot_file):
print("Extracting messages to .pot file...")
os.system(f'xgettext --from-code=UTF-8 -L Python -o {pot_file} networkmgr/*.py networkmgr')
# Create the new .po file
if not os.path.exists(po_file):
print(f"Creating new {po_file} for locale '{self.locale}'...")
os.makedirs(po_dir, exist_ok=True)
os.system(f'msginit --locale={self.locale} --input={pot_file} --output-file={po_file}')
else:
print(f"PO file for locale '{self.locale}' already exists: {po_file}")


networkmgr_share = [
'src/auto-switch.py',
Expand Down Expand Up @@ -58,7 +114,11 @@ def datafilelist(installbase, sourcebase):
data_files=data_files,
install_requires=['setuptools'],
packages=['NetworkMgr'],
scripts=['networkmgr', 'networkmgr_configuration']
scripts=['networkmgr', 'networkmgr_configuration'],
cmdclass={
'create_translation': CreateTranslationCommand,
'update_translations': UpdateTranslationsCommand,
}
)

run('gtk-update-icon-cache -f /usr/local/share/icons/hicolor', shell=True)
2 changes: 1 addition & 1 deletion src/auto-switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

# Stop the interface if it's not active or associated.
# This removes the interface from the default route.
# Restarting routing adds and nic if there is and other one that is active
# Restarting routing adds and nic if there is another one that is active
# or associated.
if not any(active_status):
os.system(f'service netif stop {nic}')
Expand Down
Loading