Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove gettext from project #291

Merged
merged 1 commit into from
Jan 8, 2025
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
101 changes: 48 additions & 53 deletions ikabot/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# -*- coding: utf-8 -*-

import datetime
import gettext
import multiprocessing
import os
import sys
Expand Down Expand Up @@ -48,10 +47,6 @@
from ikabot.helpers.process import updateProcessList
from ikabot.web.session import *

t = gettext.translation("command_line", localedir, languages=languages, fallback=True)
_ = t.gettext


def menu(session, checkUpdate=True):
"""
Parameters
Expand Down Expand Up @@ -149,28 +144,28 @@ def menu(session, checkUpdate=True):
2108: loadCustomModule
}

print(_("(0) Exit"))
print(_("(1) Construction list"))
print(_("(2) Send resources"))
print(_("(3) Distribute resources"))
print(_("(4) Account status"))
print(_("(5) Activate Shrine"))
print(_("(6) Login daily"))
print(_("(7) Alerts / Notifications"))
print(_("(8) Marketplace"))
print(_("(9) Donate"))
print(_("(10) Activate vacation mode"))
print(_("(11) Activate miracle"))
print(_("(12) Military actions"))
print(_("(13) See movements"))
print(_("(14) Construct building"))
print(_("(15) Update Ikabot"))
print(_("(16) Ikabot Web Server"))
print(_("(17) Auto-Pirate"))
print(_("(18) Investigate"))
print(_("(19) Attack barbarians"))
print(_("(20) Dump / Monitor world"))
print(_("(21) Options / Settings"))
print("(0) Exit")
print("(1) Construction list")
print("(2) Send resources")
print("(3) Distribute resources")
print("(4) Account status")
print("(5) Activate Shrine")
print("(6) Login daily")
print("(7) Alerts / Notifications")
print("(8) Marketplace")
print("(9) Donate")
print("(10) Activate vacation mode")
print("(11) Activate miracle")
print("(12) Military actions")
print("(13) See movements")
print("(14) Construct building")
print("(15) Update Ikabot")
print("(16) Ikabot Web Server")
print("(17) Auto-Pirate")
print("(18) Investigate")
print("(19) Attack barbarians")
print("(20) Dump / Monitor world")
print("(21) Options / Settings")
total_options = len(menu_actions) + 1
selected = read(min=0, max=total_options, digit=True, empty=True)

Expand All @@ -180,9 +175,9 @@ def menu(session, checkUpdate=True):

if selected == 7:
banner()
print(_("(0) Back"))
print(_("(1) Alert attacks"))
print(_("(2) Alert wine running out"))
print("(0) Back")
print("(1) Alert attacks")
print("(2) Alert wine running out")

selected = read(min=0, max=2, digit=True)
if selected == 0:
Expand All @@ -193,9 +188,9 @@ def menu(session, checkUpdate=True):

if selected == 8:
banner()
print(_("(0) Back"))
print(_("(1) Buy resources"))
print(_("(2) Sell resources"))
print("(0) Back")
print("(1) Buy resources")
print("(2) Sell resources")

selected = read(min=0, max=2, digit=True)
if selected == 0:
Expand All @@ -206,9 +201,9 @@ def menu(session, checkUpdate=True):

if selected == 9:
banner()
print(_("(0) Back"))
print(_("(1) Donate once"))
print(_("(2) Donate automatically"))
print("(0) Back")
print("(1) Donate once")
print("(2) Donate automatically")

selected = read(min=0, max=2, digit=True)
if selected == 0:
Expand All @@ -219,9 +214,9 @@ def menu(session, checkUpdate=True):

if selected == 12:
banner()
print(_("(0) Back"))
print(_("(1) Train Army"))
print(_("(2) Send Troops/Ships"))
print("(0) Back")
print("(1) Train Army")
print("(2) Send Troops/Ships")
selected = read(min=0, max=2, digit=True)
if selected == 0:
menu(session)
Expand All @@ -230,9 +225,9 @@ def menu(session, checkUpdate=True):
selected += 1200

if selected == 20:
print(_("(0) Back"))
print(_("(1) Monitor islands"))
print(_("(2) Dump & Search world"))
print("(0) Back")
print("(1) Monitor islands")
print("(2) Dump & Search world")

selected = read(min=0, max=2, digit=True)
if selected == 0:
Expand All @@ -243,18 +238,18 @@ def menu(session, checkUpdate=True):

if selected == 21:
banner()
print(_("(0) Back"))
print(_("(1) Configure Proxy"))
print("(0) Back")
print("(1) Configure Proxy")
if telegramDataIsValid(session):
print(_("(2) Change the Telegram data"))
print("(2) Change the Telegram data")
else:
print(_("(2) Enter the Telegram data"))
print(_("(3) Kill tasks"))
print(_("(4) Configure captcha resolver"))
print(_("(5) Logs"))
print(_("(6) Message Telegram Bot"))
print(_("(7) Import / Export cookie"))
print(_("(8) Load custom ikabot module"))
print("(2) Enter the Telegram data")
print("(3) Kill tasks")
print("(4) Configure captcha resolver")
print("(5) Logs")
print("(6) Message Telegram Bot")
print("(7) Import / Export cookie")
print("(8) Load custom ikabot module")

selected = read(min=0, max=8, digit=True)
if selected == 0:
Expand Down Expand Up @@ -290,7 +285,7 @@ def menu(session, checkUpdate=True):
if isWindows:
# in unix, you can exit ikabot and close the terminal and the processes will continue to execute
# in windows, you can exit ikabot but if you close the terminal, the processes will die
print(_("Closing this console will kill the processes."))
print("Closing this console will kill the processes.")
enter()
clear()
os._exit(
Expand Down
22 changes: 6 additions & 16 deletions ikabot/config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#! /usr/bin/env python3
# -*- coding: utf-8 -*-

import gettext
import locale
import os

Expand All @@ -11,16 +10,7 @@

IKABOT_VERSION_TAG = "v" + IKABOT_VERSION

local = locale.setlocale(locale.LC_ALL, "")
if "es_" in local:
languages = ["es"]
else:
languages = ["en"]
languages = ["none"]

localedir = os.path.join(os.path.abspath(os.path.dirname(__file__)), "locale")
t = gettext.translation("config", localedir, languages=languages, fallback=True)
_ = t.gettext


update_msg = ""
Expand All @@ -42,7 +32,7 @@
city_url = "view=city&cityId="
island_url = "view=island&islandId="
prompt = " >> "
materials_names = [_("Wood"), _("Wine"), _("Marble"), _("Cristal"), _("Sulfur")]
materials_names = ["Wood", "Wine", "Marble", "Cristal", "Sulfur"]
materials_names_english = ["Wood", "Wine", "Marble", "Cristal", "Sulfur"]
miracle_names_english = [
"",
Expand All @@ -64,11 +54,11 @@
"9b5578a7dfa3e98124439cca4a387a61",
]
tradegoods_names = [
_("Saw mill"),
_("Vineyard"),
_("Quarry"),
_("Crystal Mine"),
_("Sulfur Pit"),
"Saw mill",
"Vineyard",
"Quarry",
"Crystal Mine",
"Sulfur Pit",
]
ConnectionError_wait = 5 * 60
actionRequest = "REQUESTID"
Expand Down
Loading
Loading