Skip to content

Commit

Permalink
Add Translate Module locale
Browse files Browse the repository at this point in the history
  • Loading branch information
MacHu-GWU committed Oct 19, 2018
1 parent 91edc15 commit 41b40ba
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'alabaster'
html_theme = 'classic'

# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
Expand Down
1 change: 1 addition & 0 deletions docs/source/wotlkdoc/__init__.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ sub packages and modules
.. toctree::
:maxdepth: 1

locale <locale/__init__>

13 changes: 13 additions & 0 deletions docs/source/wotlkdoc/locale/__init__.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
locale
======

.. automodule:: wotlkdoc.locale
:members:

sub packages and modules
------------------------

.. toctree::
:maxdepth: 1


3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
gspread-pandas
loc
pandas_mate
29 changes: 29 additions & 0 deletions wotlkdoc/locale/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-

from loc import Locale, LocDict
import pandas as pd
from pathlib_mate import PathCls as Path

TAB = "\t"
DATA_DIR = Path(Path(__file__).change(new_basename="data"))


def read_loc_dict(file):
df = pd.read_csv(Path(DATA_DIR, file).abspath, sep=TAB)
ld = LocDict(data=df.to_dict(orient="list"))
return ld


ld_wotlk = read_loc_dict("wotlk-dict.txt")


def trim_space():
for p in DATA_DIR.select_by_ext(".txt"):
df = pd.read_csv(p.abspath, sep=TAB)
df = df.applymap(str.strip)
df.to_csv(p.abspath, index=False, sep=TAB)


if __name__ == "__main__":
trim_space()
pass
47 changes: 47 additions & 0 deletions wotlkdoc/locale/data/wotlk-dict.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
zh-CN en-US
经典旧世 Vanilla
燃烧的远征 TBC
巫妖王之怒 WLK
战士 Warrior
圣骑士 Paladin
死亡骑士 Death Knight
猎人 Hunter
萨满 Shaman
盗贼 Rogue
德鲁伊 Druid
法师 Mage
术士 Warlock
牧师 Presis
锻造 Blacksmithing
制皮 Leatherworking
裁缝 Tailoring
采药 Herbalsim
炼金 Alchemy
采矿 Mining
剥皮 Skinning
附魔 Enchanting
工程学 Engineering
珠宝加工 Jewelcrafting
铭文 Inscription
火焰 Fire
冰霜 Frost
奥术 Arcane
自然 Nature
暗影 Shadow
神圣 Holy
联盟 Alliance
部落 Horde
小队副本 Dungeon
团队副本 Raid
职业 Class
职业技能 Class Skill
职业技能训练师 Class Skill Trainer
商业技能 Trade Skill
商业技能训练师 Trade Skill Trainer
任务 Quest
职业任务 Class Quest
普通 Common
优秀 Uncommon
精良 Rare
史诗 Epic
传奇 Legendary

0 comments on commit 41b40ba

Please sign in to comment.