File size: 415 Bytes
8a469fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import os
import json

i18n = {}


def get_i18n(reload=False):
    global i18n
    if reload or not i18n:
        i18n = {}
        current_dir = os.path.dirname(os.path.abspath(__file__))
        config_file = os.path.join(current_dir, '../../i18n.json')
        config_file = os.path.normpath(config_file)
        with open(config_file, 'r', encoding='utf8') as f:
            i18n = json.load(f)
    return i18n