diff --git a/RichSpan.py b/RichSpan.py
index 7a9f52d..78fb905 100644
--- a/RichSpan.py
+++ b/RichSpan.py
@@ -1,5 +1,6 @@
import base64
import datetime
+import locale
import mimetypes
import os
import sys
@@ -8,7 +9,6 @@
import chardet
import mammoth
import psutil
-import qtawesome as qta
from langdetect import DetectorFactory, detect
from PySide6.QtCore import *
from PySide6.QtGui import *
@@ -35,7 +35,7 @@
"isSaved": None,
"scrollPosition": None,
"appTheme": "light",
- "appLanguage": "English",
+ "appLanguage": "1252",
"adaptiveResponse": 1,
"readFilter": "General File (*.rsdoc *.docx);;HTML (*.html);;Text (*.txt);;Key-Value (*.ini);;LOG (*.log);;JavaScript Object Notation (*.json);;Extensible Markup Language (*.xml);;Javascript (*.js);;Cascading Style Sheets (*.css);;Structured Query Language (*.sql);;Markdown (*.md)",
"writeFilter": "RichSpan Document (*.rsdoc);;HTML (*.html);;Text (*.txt);;Key-Value (*.ini);;LOG (*.log);;JavaScript Object Notation (*.json);;Extensible Markup Language (*.xml);;Javascript (*.js);;Cascading Style Sheets (*.css);;Structured Query Language (*.sql);;Markdown (*.md)",
@@ -43,6 +43,24 @@
}
+# Locale ID (LCID)
+languages = {
+ "1252": "English",
+ "1031": "Deutsch",
+ "1034": "Español",
+ "1055": "Türkçe",
+ "1068": "Azərbaycanca",
+ "1091": "Uzbek",
+ "2052": "中文", # Chinese
+ "1042": "한국어", # Korean
+ "1041": "日本語", # Japanese
+ "1025": "العربية", # Saudi Arabia
+ "1049": "Русский", # Russia
+ "1036": "Français",
+ "1032": "Ελληνικά", # Greek
+}
+
+
class RS_Threading(QThread):
update_signal = Signal()
@@ -87,7 +105,7 @@ def __init__(self, parent=None):
f"{app.applicationDisplayName()}
"
"Real-time computing and formatting supported word processor
"
"Made by Berkay Gediz
"
- "GNU General Public License v3.0
GNU LESSER GENERAL PUBLIC LICENSE v3.0
Mozilla Public License Version 2.0
Libraries: mwilliamson/python-mammoth, Mimino666/langdetect, PySide6, chardet, psutil, qtawesome
"
+ "GNU General Public License v3.0
GNU LESSER GENERAL PUBLIC LICENSE v3.0
Mozilla Public License Version 2.0
Libraries: mwilliamson/python-mammoth, Mimino666/langdetect, PySide6, chardet, psutil
"
"OpenGL: ON"
)
self.setCentralWidget(self.about_label)
@@ -96,16 +114,17 @@ def __init__(self, parent=None):
class RS_Workspace(QMainWindow):
def __init__(self, parent=None):
super(RS_Workspace, self).__init__(parent)
- self.setWindowIcon(QIcon("richspan_icon.ico"))
- self.setWindowModality(Qt.WindowModality.ApplicationModal)
- self.setMinimumSize(768, 540)
QTimer.singleShot(0, self.initUI)
def initUI(self):
starttime = datetime.datetime.now()
+ self.setWindowIcon(QIcon("richspan_icon.ico"))
+ self.setWindowModality(Qt.WindowModality.ApplicationModal)
+ self.setMinimumSize(768, 540)
+ system_language = locale.getlocale()[1]
settings = QSettings("berkaygediz", "RichSpan")
- if settings.value("appLanguage") == None:
- settings.setValue("appLanguage", "English")
+ if system_language not in languages.keys():
+ settings.setValue("appLanguage", "1252")
settings.sync()
if settings.value("adaptiveResponse") == None:
settings.setValue("adaptiveResponse", 1)
@@ -187,9 +206,8 @@ def closeEvent(self, event):
event.accept()
def RS_changeLanguage(self):
- language = self.language_combobox.currentText()
settings = QSettings("berkaygediz", "RichSpan")
- settings.setValue("appLanguage", language)
+ settings.setValue("appLanguage", self.language_combobox.currentData())
settings.sync()
self.RS_updateTitle()
self.RS_updateStatistics()
@@ -260,7 +278,7 @@ def RS_updateStatistics(self):
lowercase_count = sum(1 for char in text if char.islower())
statistics += f"