Skip to content
This repository was archived by the owner on Apr 2, 2025. It is now read-only.

Commit 3eddd23

Browse files
committed
Update v1.9 | Language support improved
1 parent 97ffdd8 commit 3eddd23

29 files changed

+94
-471
lines changed

README.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ You can download and use Anka Browser in every Python installed device.
1919

2020

2121
- ### Languages:
22-
Now, Anka Browser is support two language. Türkçe(Turkish) and English. You can find English version from
23-
``/src/en-En/`` and you can find Türkçe(Turkish) version from ``/src/tr-TR/``
22+
Now, Anka Browser is support two language. Türkçe(Turkish) and English. You can change language from settings.
2423

2524
- ### History update:
2625
Your search history is save to /public/browser/history.txt. If you want delete history, you can delete from "Delete History" button from Settings.
@@ -78,23 +77,9 @@ You can download and use Anka Browser in every Python installed device.
7877

7978
1. ``cd Anka``
8079

81-
2. ``cd src``
80+
2. ``python3 anka-browser.py``
8281

83-
3. ``cd en-EN``
8482

85-
4. ``python3 anka-browser.py``
86-
87-
### Türkçe Versiyon(Turkish Version):
88-
Kaynak kodunu indirin, isterseniz ingilizce kaynak kodu indirmeyebilirsiniz. Kaynak kodunu
89-
indirdiğiniz klasöre geçin ve şu kodları terminale yazın:
90-
91-
1. ``cd Anka``
92-
93-
2. ``cd src``
94-
95-
3. ``cd tr-TR``
96-
97-
4. ``python3 anka-browser.py``
9883

9984

10085
## Warnings:
Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,21 @@
55
from PyQt6.QtCore import *
66
from PyQt6.QtGui import *
77
import configparser
8+
import json
89

910

1011

11-
tab_name = "Yeni Sekme"
12-
history = "./public/browser/history.txt"
1312
config_path = "./config/config.conf"
13+
config = configparser.ConfigParser()
14+
config.read(config_path)
15+
16+
language = config["Language"]["language"]
17+
18+
with open(f"./public/browser/languages/{language}.json", "r", encoding="UTF-8") as jsonn:
19+
texts = json.load(jsonn)
20+
21+
tab_name = texts["tab-name"]
22+
history = "./public/browser/history.txt"
1423
bookmarks = "./public/browser/bookmarks.txt"
1524

1625
if not os.path.exists(history):
@@ -28,8 +37,7 @@
2837
with open(bookmarks, 'x') as bf:
2938
pass
3039

31-
config = configparser.ConfigParser()
32-
config.read(config_path)
40+
3341

3442
search_engine = config['Settings']['search_engine']
3543
tab_color = config['Appearance']['tab_color']
@@ -68,7 +76,7 @@ def __init__(self):
6876

6977
self.url_bar = QLineEdit()
7078
self.url_bar.returnPressed.connect(self.load_url)
71-
self.url_bar.setPlaceholderText("URL ya da metin girin...")
79+
self.url_bar.setPlaceholderText(texts["url_bar_placeholder"])
7280
self.url_bar.setFont(QFont("Lexend"))
7381
self.url_bar.setFixedHeight(25)
7482
self.url_bar.setStyleSheet("white-space: nowrap;")
@@ -229,12 +237,12 @@ def browser_reload(self):
229237
def show_context_menu(self, position):
230238
context_menu = QMenu(self)
231239

232-
context_menu.addAction("Kopyala", self.browser_copy)
233-
context_menu.addAction("Yapıştır", self.browser_paste)
234-
context_menu.addAction("Kaydet", self.browser_save)
235-
context_menu.addAction("Geri", self.browser_back)
236-
context_menu.addAction("İleri", self.browser_forward)
237-
context_menu.addAction("Yeniden Yükle", self.browser_reload)
240+
context_menu.addAction(texts["right-click-copy"], self.browser_copy)
241+
context_menu.addAction(texts["right-click-paste"], self.browser_paste)
242+
context_menu.addAction(texts["right-click-save"], self.browser_save)
243+
context_menu.addAction(texts["right-click-back"], self.browser_back)
244+
context_menu.addAction(texts["right-click-forward"], self.browser_forward)
245+
context_menu.addAction(texts["right-click-reload"], self.browser_reload)
238246

239247

240248
context_menu.exec(self.tabs.currentWidget().mapToGlobal(position))
@@ -296,13 +304,13 @@ def load_bookmarks(self, top_layout):
296304
class AnkaBrowserSettings(QDialog):
297305
def __init__(self, parent=None):
298306
super().__init__(parent)
299-
self.setWindowTitle("Anka | Ayarlar")
300-
self.setFixedSize(QSize(500,225))
307+
self.setWindowTitle(texts["settings-title"])
308+
self.setFixedSize(QSize(500,300))
301309

302310

303311
layout = QVBoxLayout()
304312

305-
self.search_engine_label = QLabel("Arama Motoru: ")
313+
self.search_engine_label = QLabel(texts["settings-search-engine"])
306314
layout.addWidget(self.search_engine_label)
307315

308316
self.search_engine = QComboBox()
@@ -312,6 +320,9 @@ def __init__(self, parent=None):
312320
self.search_engine.addItem("Bing")
313321
self.search_engine.addItem("Brave")
314322
self.search_engine.addItem("Startpage")
323+
324+
self.language_label = QLabel("Dil / Language")
325+
layout.addWidget(self.language_label)
315326

316327
if search_engine == "https://google.com":
317328
self.search_engine.setCurrentIndex(0)
@@ -326,26 +337,38 @@ def __init__(self, parent=None):
326337

327338
layout.addWidget(self.search_engine)
328339

329-
self.tab_color_button_label = QLabel("Sekme rengi seçin: ")
340+
self.language = QComboBox()
341+
self.language.setFixedSize(450,25)
342+
self.language.addItem("tr-TR")
343+
self.language.addItem("en-EN")
344+
345+
if language == "tr-TR":
346+
self.language.setCurrentIndex(0)
347+
else:
348+
self.language.setCurrentIndex(1)
349+
350+
layout.addWidget(self.language)
351+
352+
self.tab_color_button_label = QLabel(texts["settings-tab-color-label"])
330353
layout.addWidget(self.tab_color_button_label)
331354

332-
self.tab_color_button = QPushButton("Sekme Rengi")
355+
self.tab_color_button = QPushButton(texts["settings-tab-color-button"])
333356
self.tab_color_button.setFixedSize(QSize(450,25))
334357
self.tab_color_button.clicked.connect(self.open_tab_color_dialog)
335358
layout.addWidget(self.tab_color_button)
336359

337-
self.delete_history_button = QPushButton("Geçmişi Sil")
360+
self.delete_history_button = QPushButton(texts["settings-history"])
338361
self.delete_history_button.setFixedSize(QSize(450,25))
339362
self.delete_history_button.clicked.connect(self.delete_history)
340363
layout.addWidget(self.delete_history_button)
341364

342-
self.note_label = QLabel("Ayarları yapılandırmak için lütfen tarayıcıyı yeniden başlatın.")
365+
self.note_label = QLabel(texts["settings-info-msg"])
343366
self.note_label.setStyleSheet("padding-top: 5px;")
344367
layout.addWidget(self.note_label)
345368

346369
self.buttons = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel)
347-
self.buttons.button(QDialogButtonBox.StandardButton.Cancel).setText("İptal")
348-
self.buttons.button(QDialogButtonBox.StandardButton.Ok).setText("Tamam")
370+
self.buttons.button(QDialogButtonBox.StandardButton.Cancel).setText(texts["settings-button-cancel"])
371+
self.buttons.button(QDialogButtonBox.StandardButton.Ok).setText(texts["settings-button-ok"])
349372
self.buttons.accepted.connect(self.ok)
350373
self.buttons.rejected.connect(self.cancel)
351374
layout.addWidget(self.buttons)
@@ -363,6 +386,13 @@ def ok(self):
363386
config["Settings"]["search_engine"] = "https://search.brave.com"
364387
elif s_engine == "StartPage":
365388
config["Settings"]["search_engine"] = "https://startpage.com"
389+
390+
lan = self.language.currentText()
391+
match lan:
392+
case "tr-TR":
393+
config["Language"]["language"] = "tr-TR"
394+
case "en-EN":
395+
config["Language"]["language"] = "en-EN"
366396

367397
with open('config/config.conf', 'w' ) as configfile:
368398
config.write(configfile)
@@ -383,7 +413,7 @@ def delete_history(self):
383413
class Tab_Color_Dialog(QColorDialog):
384414
def __init__(self, parent=None):
385415
super().__init__(parent)
386-
self.setWindowTitle("Anka | Renk Seçin")
416+
self.setWindowTitle(texts["tab-color-dialog-title"])
387417
self.setFixedSize(QSize(500,159))
388418

389419
tabColor = Tab_Color_Dialog.getColor()
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ search_engine = https://google.com
55
tab_color = #2aa1b3
66
not_selected_tab_color = #22818f
77

8+
[Language]
9+
language = tr-TR
10+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"tab-name" : "New Tab",
3+
"url_bar_placeholder" : "Enter URL or text...",
4+
"right-click-copy" : "Copy",
5+
"right-click-paste" : "Paste",
6+
"right-click-save" : "Save",
7+
"right-click-back" : "Back",
8+
"right-click-forward" : "Forward",
9+
"right-click-reload" : "Reload",
10+
"settings-title" : "Anka | Settings",
11+
"settings-search-engine" : "Search Engine",
12+
"settings-tab-color-label" : "Select tab color: ",
13+
"settings-tab-color-button" : "Tab Color",
14+
"settings-history" : "Delete History",
15+
"settings-info-msg" : "Please restart the browser for configure the settings.",
16+
"settings-button-ok" : "Ok",
17+
"settings-button-cancel" : "Cancel",
18+
"tab-color-dialog-title" : "Anka | Select Color"
19+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"tab-name" : "Yeni Sekme",
3+
"url_bar_placeholder" : "URL ya da metin girin...",
4+
"right-click-copy" : "Kopyala",
5+
"right-click-paste" : "Yapıştır",
6+
"right-click-save" : "Kaydet",
7+
"right-click-back" : "Geri",
8+
"right-click-forward" : "İleri",
9+
"right-click-reload" : "Yeniden Yükle",
10+
"settings-title" : "Anka | Ayarlar",
11+
"settings-search-engine" : "Arama Motoru: ",
12+
"settings-tab-color-label" : "Sekme rengi seçin: ",
13+
"settings-tab-color-button" : "Sekme Rengi",
14+
"settings-history" : "Geçmişi Sil",
15+
"settings-info-msg" : "Ayarları yapılandırmak için lütfen tarayıcıyı yeniden başlatın.",
16+
"settings-button-ok" : "Tamam",
17+
"settings-button-cancel" : "İptal",
18+
"tab-color-dialog-title" : "Anka | Renk Seçin"
19+
}

0 commit comments

Comments
 (0)