Skip to content

Commit f38c09d

Browse files
committed
upload: initial
0 parents  commit f38c09d

File tree

6 files changed

+148
-0
lines changed

6 files changed

+148
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.idea/
2+
venv/
3+
out/

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AyuGram Localization
2+
3+
We store all string values here.

scripts/generate-android.py

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
from lxml import etree as et
2+
3+
import json
4+
import os.path
5+
6+
if not os.path.exists('./values'):
7+
os.chdir('../')
8+
9+
with open('./values/Shared.json') as f:
10+
strings = json.load(f)
11+
12+
root = et.Element('resources')
13+
14+
for k, v in strings.items():
15+
string = et.SubElement(root, 'string', {'name': k.replace('ayu_', '')})
16+
string.text = v
17+
18+
tree = et.ElementTree(root)
19+
20+
if not os.path.exists('./out'):
21+
os.mkdir('./out')
22+
23+
tree.write('./out/ayu.xml', pretty_print=True, xml_declaration=True, encoding="utf-8")
24+
25+
print('Done.')

scripts/generate-desktop.py

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import json
2+
import os.path
3+
4+
import requests
5+
6+
if not os.path.exists('./values'):
7+
os.chdir('../')
8+
9+
with open('./values/Shared.json') as f:
10+
strings = json.load(f)
11+
12+
req = requests.get(
13+
'https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/langs/lang.strings'
14+
)
15+
16+
data = req.text
17+
data += '''
18+
19+
// AyuGram keys generated
20+
21+
'''
22+
23+
for k, v in strings.items():
24+
escaped = v.replace('"', '\\"')
25+
data += f'"{k}" = "{escaped}";\n'
26+
27+
if not os.path.exists('./out'):
28+
os.mkdir('./out')
29+
30+
with open(os.path.realpath('./out/lang.strings'), 'w', encoding='utf-8') as f:
31+
f.write(data)
32+
33+
print('Done.')

scripts/useless/migrate.py

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import json
2+
3+
import bs4
4+
import requests
5+
6+
with open('ayu.xml') as f:
7+
text = f.read()
8+
9+
tree = bs4.BeautifulSoup(text, 'xml')
10+
11+
strings = {}
12+
for string in tree.find_all('string'):
13+
t = string.attrs['name']
14+
strings[f'ayu_{t}'] = string.text
15+
16+
with open('./values/Shared.json', 'w') as f:
17+
json.dump(strings, f, indent=2)
18+
19+
print('Done.')

values/Shared.json

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
{
2+
"ayu_AyuPreferences": "AyuGram Preferences",
3+
"ayu_GhostEssentialsHeader": "Ghost essentials",
4+
"ayu_SendReadPackets": "Send read status",
5+
"ayu_SendOnlinePackets": "Send online status",
6+
"ayu_SendUploadProgress": "Send typing & upload status",
7+
"ayu_SendOfflinePacketAfterOnline": "Immediate offline after online",
8+
"ayu_MarkReadAfterSend": "Send read status after reply",
9+
"ayu_UseScheduledMessages": "Schedule messages",
10+
"ayu_SpyEssentialsHeader": "Spy essentials",
11+
"ayu_KeepDeletedMessages": "Keep deleted messages",
12+
"ayu_KeepMessagesHistory": "Keep edits history",
13+
"ayu_QoLTogglesHeader": "Useful features",
14+
"ayu_ShowFromChannel": "Show \u00abchannel\u00bb label",
15+
"ayu_KeepAliveService": "Keep Alive Service",
16+
"ayu_EnableAds": "Enable ads",
17+
"ayu_CustomizationHeader": "Customization",
18+
"ayu_DeletedMarkText": "Deleted mark",
19+
"ayu_EditedMarkText": "Edited mark",
20+
"ayu_ShowGhostToggleInDrawer": "Show ghost mode toggle",
21+
"ayu_ShowKllButtonInDrawer": "Show kill app button",
22+
"ayu_AyuSyncHeader": "AyuSync",
23+
"ayu_AyuSyncStatusTitle": "Sync status",
24+
"ayu_AyuSyncStatusOk": "connected",
25+
"ayu_AyuSyncStatusErrorDisconnected": "disconnected",
26+
"ayu_AyuSyncStatusErrorNotRegistered": "not registered",
27+
"ayu_AyuSyncStatusErrorNoToken": "no token",
28+
"ayu_AyuSyncStatusErrorInvalidToken": "invalid token",
29+
"ayu_AyuSyncStatusErrorNoMVP": "no MVP",
30+
"ayu_AyuSyncServerURL": "AyuSync URL",
31+
"ayu_AyuSyncServerToken": "AyuSync token",
32+
"ayu_AyuSyncEnable": "Enable synchronization",
33+
"ayu_AyuSyncVisitProfile": "Visit profile",
34+
"ayu_AyuSyncForceSync": "Force sync clients",
35+
"ayu_AyuSyncDeviceIdentifier": "Device identifier",
36+
"ayu_AyuSyncLastEventSent": "Last sent event",
37+
"ayu_AyuSyncLastEventReceived": "Last received event",
38+
"ayu_AyuSyncLastEventNever": "never",
39+
"ayu_AyuSyncUseSecureConnection": "Use HTTPS & WSS",
40+
"ayu_AyuSyncIdentifierCopied": "Identifier copied to clipboard.",
41+
"ayu_CleanDatabase": "Clean database",
42+
"ayu_WALMode": "Enable WAL mode",
43+
"ayu_CleanDatabaseNotification": "AyuGram database cleaned",
44+
"ayu_EnableGhostMode": "Enable Ghost",
45+
"ayu_DisableGhostMode": "Disable Ghost",
46+
"ayu_KillApp": "Kill App",
47+
"ayu_GhostModeEnabled": "Ghost mode turned on",
48+
"ayu_GhostModeDisabled": "Ghost mode turned off",
49+
"ayu_EditsHistoryTitle": "Edits history",
50+
"ayu_EditsHistoryMenuText": "History",
51+
"ayu_ReadUntilMenuText": "Read until",
52+
"ayu_ForwardsRestrictedInfoDeleted": "Forwarding of a deleted message is not supported.",
53+
"ayu_DeleteDateMenuText": "Delete Date",
54+
"ayu_LikelyOfflineStatus": "offline ?",
55+
"ayu_GhostModeShortcut": "Enter with Ghost",
56+
"ayu_SettingsWatermark": "AyuGram developed and maintained by Radolyn Labs.",
57+
"ayu_SettingsCustomizationHint": "After making changes to the \"Customization\" section, you must restart the application.",
58+
"ayu_SettingsRecentStickersCount": "Recent stickers count",
59+
"ayu_SettingsShowID": "Show peer ID",
60+
"ayu_SettingsShowID_Hide": "Hide",
61+
"ayu_SettingsShowMessageSeconds": "Show message seconds",
62+
"ayu_ContextCopyID": "Copy ID",
63+
"ayu_IDCopiedToast": "ID copied to clipboard.",
64+
"ayu_DrawerGhostModeToggle": "Ghost Mode"
65+
}

0 commit comments

Comments
 (0)