```python
import os
import json

def paser(text):
    lines = filter(lambda x: x and not x.startswith('//'),map(lambda x:x.strip(),text.split('\n')))
    block_comment = False
    new_lines = []
    for l in lines:
        if l[:2] == '/*' and l[-2:] == '*/':
            continue
        elif l[:2] == '/*':
            block_comment = True
            continue
        elif '*/' in l and block_comment:
            block_comment = False
            continue
        elif block_comment:
            continue
        else:
            new_lines.append(l)
    return '\n'.join(new_lines)

def loads(text):
    return json.loads(paser(text))

item_types = {}
item_json = {}
item_sname = {}
path = u'/Users/bhr/Library/Application Support/Steam/steamapps/common/Starbound/giraffe_storage/mods/zh-cn/items'
def func(args,dirs,files):
    for f in files:
        filename_l = f.split('.')
        if len(filename_l) == 3 and filename_l[-1] == 'patch':
            item_name = filename_l[0]
            item_type = filename_l[1]
            if item_types.has_key(item_type):
                item_types[item_type].append(item_name)
                item_types[item_type].sort()
            else:
                item_types[item_type] = [item_name]
            filepath = os.path.join(dirs,f)
            with file(filepath, 'r') as f:
                try:
                    item_json[item_name] = loads(f.read())
                except:
                    pass
os.path.walk(path,func,0)
for k,v in item_json.iteritems():
    for it in v:
        if it.has_key(u'path') and it[u'path'] == u'/shortdescription':
            item_sname[k] = it[u'value']

item_oname = {}
item_ojson = {}
opath = u'/Users/bhr/Library/Application Support/Steam/steamapps/common/Starbound/assets/package'
def func2(args, dirs,files):
    for f in files:
        filename_l = f.split('.')
        if (len(filename_l) > 1) and filename_l[-1] in item_types:
            filepath = os.path.join(dirs,f)
            with file(filepath, 'r') as ff:
                try:
                    data = loads(ff.read())
                except:
                    print 'json_err: {0}'.format(filepath)
                else:
                    try:
                        if 'itemName' in data:
                            item_ojson[data['itemName']] = data
                            item_oname[data['itemName']] = data.get('shortdescription','')
                        elif 'name' in data:
                            item_ojson[data['name']] = data
                            item_oname[data['name']] = data.get('shortdescription','')
                    except:
                        print 'KeyError: itemName, {0}'.format(filepath)
os.path.walk(opath,func2,0)

filetypes = {}
def func3(args, dirs,files):
    for f in files:
        filename_l = f.split('.')
        if (len(filename_l) > 1):
            filetypes[filename_l[-1]] = True
os.path.walk(opath,func3,0)

has_names = []
for t in filetypes:
    if t in item_types:
        has_names.extend(item_types[t])
has_names  = sorted(list(set(has_names)))

os.path.walk(opath,func2,0)
name_trans = {}
for k,v in item_sname.iteritems():
    if k in item_oname:
        name_trans[k] = [item_oname[k],v]

for n in has_names:
    if n not in item_sname:
        print n

save_file = u'/Users/bhr/starbound_trans.csv'
with open(save_file, 'w') as f:
    for k,v in sorted(name_trans.iteritems()):
        try:
            cn_name = v[1].encode('utf-8')
        except:
            continue
        line = "{0},{1},{2}\n".format(k,v[0],cn_name)
        f.write(line)
```

<style>.wiki-article pre{max-width:none;max-height:none;}</style>

<style>.wiki-article{background-color:black !important;color:white !important;}body{color: #FFF !important;background-color: #000 !important;}td{vertical-align: middle !important;}.wiki-article table{width:auto !important;margin:auto !important;}</style>