smart-translate 0.1.0__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {smart_translate-0.1.0 → smart_translate-0.1.2}/PKG-INFO +1 -1
- {smart_translate-0.1.0 → smart_translate-0.1.2}/pyproject.toml +1 -1
- smart_translate-0.1.2/smart_translate/rules.py +12 -0
- smart_translate-0.1.2/smart_translate/rules_loader.py +7 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate.egg-info/PKG-INFO +1 -1
- smart_translate-0.1.0/smart_translate/rules.py +0 -12
- smart_translate-0.1.0/smart_translate/rules_loader.py +0 -10
- {smart_translate-0.1.0 → smart_translate-0.1.2}/README.md +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/setup.cfg +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate/__init__.py +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate/config.py +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate/protector.py +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate/rules/custom_rules.json +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate/translator.py +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate.egg-info/SOURCES.txt +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate.egg-info/dependency_links.txt +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate.egg-info/requires.txt +0 -0
- {smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate.egg-info/top_level.txt +0 -0
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
from importlib import resources
|
|
2
|
-
import json
|
|
3
|
-
|
|
4
|
-
def load_custom_rules():
|
|
5
|
-
with resources.files("smart_translate.rules").joinpath("custom_rules.json").open("r") as f:
|
|
6
|
-
return json.load(f)
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def apply_custom_rules(text, rules=CUSTOM_REPLACEMENTS):
|
|
10
|
-
for src, tgt in rules.items():
|
|
11
|
-
text = text.replace(src, tgt)
|
|
12
|
-
return text
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{smart_translate-0.1.0 → smart_translate-0.1.2}/smart_translate.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|