Skip to content

Commit

Permalink
Update build script and icons
Browse files Browse the repository at this point in the history
1. Use build script from CanCLID/ToJyutping@f607036
2. Add icon of more sizes
  • Loading branch information
ayaka14732 committed Sep 11, 2020
1 parent fed0e40 commit 5c74017
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
18 changes: 4 additions & 14 deletions build.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,20 @@
import json
from opencc import OpenCC
import os

# Library
os.system('wget -nc -O lib/browser-polyfill.js https://unpkg.com/webextension-polyfill@0.6.0/dist/browser-polyfill.js')

# Preprocess
os.system('wget -nc https://github.com/CanCLID/ToJyutping/raw/master/preprocess.py')
os.system('wget -nc https://github.com/CanCLID/ToJyutping/raw/f607036f6cce114fced2502aa0d2d0d8169b67f6/preprocess.py')
os.system("sed -i 's/src\/ToJyutping\/jyut6ping3.simple.dict.yaml/jyut6ping3.simple.dict.yaml/' preprocess.py")
os.system('python preprocess.py')

# Build dictionary
converter = OpenCC('t2s')

d_t = {}
d_cn = {}
l = []

with open('jyut6ping3.simple.dict.yaml') as f:
for line in f:
k_t, v = line.rstrip('\n').split('\t')
k_cn = converter.convert(k_t)
d_t[k_t] = v
d_cn[k_cn] = v

d = {**d_cn, **d_t} # prefer t over cn
l = list(d.items())
k, v = line.rstrip('\n').split('\t')
l.append((k, v))

with open('background_scripts/dictionary.json.txt', 'w') as f:
f.write(json.dumps(l, ensure_ascii=False).replace('], [', '],\n['))
Expand Down
Binary file added icons/128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icons/48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
{
"manifest_version": 2,
"name": "__MSG_extensionName__",
"version": "0.2.0",
"version": "0.2.1",
"description": "__MSG_extensionDescription__",
"icons": {
"96": "icons/96.png"
"48": "icons/48.png",
"96": "icons/96.png",
"128": "icons/128.png"
},
"content_scripts": [
{
Expand Down

0 comments on commit 5c74017

Please sign in to comment.