Browse Source

번역 추가

잉여개발기 (SPDV) 1 year ago
parent
commit
ca33aa4a6b
8 changed files with 102 additions and 46 deletions
  1. 6 0
      app.py
  2. 21 0
      lang/en-US.json
  3. 2 3
      lang/help_tool.py
  4. 20 1
      lang/ko-KR.json
  5. 46 42
      route/give_admin_groups.py
  6. 5 0
      route/tool/func.py
  7. BIN
      route_go/bin/main.amd64.exe
  8. 2 0
      route_go/route/tool/language.go

+ 6 - 0
app.py

@@ -1,6 +1,7 @@
 # Init
 import os
 import re
+import signal
 import logging
 import waitress
 
@@ -843,6 +844,11 @@ app.route('/update', methods = ['POST', 'GET'])(main_sys_update)
 
 app.errorhandler(404)(main_func_error_404)
 
+def signal_handler(signal, frame):
+    os._exit(0)
+
+signal.signal(signal.SIGINT, signal_handler)
+
 if __name__ == "__main__":
     waitress.serve(
         app,

+ 21 - 0
lang/en-US.json

@@ -1,6 +1,27 @@
 {
     "language_tag": "en-US",
 
+    "_comment_" : "No category",
+    "recent_edit_request" : "Recent edit request",
+    "all_function_authority" : "All function authority",
+    "bbs_authority" : "BBS authority",
+    "treat_as_admin_authority" : "Treat as admin authority",
+    "backup_count" : "Maximum number of backup files",
+    "template_var_1" : "Template variable 1",
+    "template_var_2" : "Template variable 2",
+    "template_var_3" : "Template variable 3",
+    "sidebar" : "Sidebar",
+    "document_make_acl" : "Document create ACL",
+    "document_edit_request_acl" : "Document edit request ACL",
+    "up_to_level_3" : "Level 3 or higher",
+    "up_to_level_10" : "Level 10 or higher",
+    "document_top" : "Top of document phrases",
+    "document_editor_top" : "Top of document editor phrases",
+    "cidr" : "CIDR",
+    "option" : "Option",
+    "edit_request_able" : "Edit request available",
+    "date" : "Date",
+
     "_comment_" : "Common",
     "data" : "Data",
     "volume" : "Volume",

+ 2 - 3
lang/help_tool.py

@@ -1,12 +1,11 @@
 import re
 import json
-import orjson
 
-o_json = orjson.loads(open('en-US.json', encoding = 'utf8').read())
+o_json = json.loads(open('en-US.json', encoding = 'utf8').read())
 
 print('n_name : ', end = '')
 n_name = input()
-n_json = orjson.loads(open(n_name + '.json', encoding = 'utf8').read())
+n_json = json.loads(open(n_name + '.json', encoding = 'utf8').read())
 
 print()
 for i in list(n_json):

+ 20 - 1
lang/ko-KR.json

@@ -648,5 +648,24 @@
     "404_page": "아래의 입력을 404 페이지로 사용",
     "404_file": "루트 폴더 안의 404.html 사용",
     "completely_ban": "완전 차단",
-    "dont_come_this_site": "사이트 접근 차단"
+    "dont_come_this_site": "사이트 접근 차단",
+    "recent_edit_request": "최근 편집 요청",
+    "all_function_authority": "모든 기능 권한",
+    "bbs_authority": "BBS 권한",
+    "treat_as_admin_authority": "관리자로 취급 권한",
+    "backup_count": "최대 백업 파일 갯수",
+    "template_var_1": "템플릿 변수 1",
+    "template_var_2": "템플릿 변수 2",
+    "template_var_3": "템플릿 변수 3",
+    "sidebar": "사이드바",
+    "document_make_acl": "문서 생성 ACL",
+    "document_edit_request_acl": "문서 편집 요청 ACL",
+    "up_to_level_3": "레벨 3 이상",
+    "up_to_level_10": "레벨 10 이상",
+    "document_top": "문서 상단 문구",
+    "document_editor_top": "문서 편집기 상단 문구",
+    "cidr": "CIDR",
+    "option": "옵션",
+    "edit_request_able": "편집 요청 가능",
+    "date": "날짜"
 }

+ 46 - 42
route/give_admin_groups.py

@@ -6,45 +6,50 @@ def give_admin_groups(name = 'test'):
 
         acl_name_list = [
             [1, 'owner', get_lang(conn, 'owner_authority')],
-            [2, '', get_lang(conn, 'all_function_authority'), True],
-            [2, 'admin', get_lang(conn, 'admin_authority')],
-            [3, 'ban', get_lang(conn, 'ban_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'toron', get_lang(conn, 'discussion_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'check', get_lang(conn, 'user_check_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'acl', get_lang(conn, 'document_acl_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'hidel', get_lang(conn, 'history_hide_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'give', get_lang(conn, 'authorization_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'bbs', get_lang(conn, 'bbs_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'vote', get_lang(conn, 'vote_authority')],
-            [4, '', get_lang(conn, 'admin_default_feature_authority'), True],
-            [3, 'admin_default_feature', get_lang(conn, 'admin_default_feature_authority')],
-            [4, 'treat_as_admin', get_lang(conn, 'treat_as_admin_authority')],
-            [4, 'user_name_bold', get_lang(conn, 'user_name_bold_authority')],
-            [4, 'multiple_upload', get_lang(conn, 'multiple_upload_authority')],
-            [4, 'slow_edit_pass', get_lang(conn, 'slow_edit_pass_authority')],
-            [4, 'edit_bottom_compulsion_pass', get_lang(conn, 'edit_bottom_compulsion_pass_authority')],
-            [4, '', get_lang(conn, 'user_authority'), True],
+                [2, '', get_lang(conn, 'all_function_authority')],
+                [2, 'admin', get_lang(conn, 'admin_authority')],
+                    [3, 'ban', get_lang(conn, 'ban_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'toron', get_lang(conn, 'discussion_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'check', get_lang(conn, 'user_check_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'acl', get_lang(conn, 'document_acl_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'hidel', get_lang(conn, 'history_hide_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'give', get_lang(conn, 'authorization_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'bbs', get_lang(conn, 'bbs_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'vote', get_lang(conn, 'vote_authority')],
+                        [4, '', get_lang(conn, 'admin_default_feature_authority')],
+                    [3, 'admin_default_feature', get_lang(conn, 'admin_default_feature_authority')],
+                        [4, 'treat_as_admin', get_lang(conn, 'treat_as_admin_authority')],
+                        [4, 'user_name_bold', get_lang(conn, 'user_name_bold_authority')],
+                        [4, 'multiple_upload', get_lang(conn, 'multiple_upload_authority')],
+                        [4, 'slow_edit_pass', get_lang(conn, 'slow_edit_pass_authority')],
+                        [4, 'edit_bottom_compulsion_pass', get_lang(conn, 'edit_bottom_compulsion_pass_authority')],
+                        [4, '', get_lang(conn, 'user_authority')],
             [1, 'user', get_lang(conn, 'user_authority')],
-            [2, 'captcha_pass', get_lang(conn, 'captcha_pass_authority')],
-            [2, 'ip', get_lang(conn, 'ip_authority')],
-            [3, 'view', get_lang(conn, 'view_authority')],
-            [4, 'document', get_lang(conn, 'document_authority')],
-            [5, 'edit', get_lang(conn, 'edit_authority')],
-            [5, 'move', get_lang(conn, 'move_authority')],
-            [5, 'new_make', get_lang(conn, 'new_make_authority')],
-            [5, 'delete', get_lang(conn, 'delete_authority')],
-            [4, 'edit_request', get_lang(conn, 'edit_request_authority')],
-            [4, 'discuss', get_lang(conn, 'discuss_authority')],
-            [4, 'upload', get_lang(conn, 'upload_authority')],
-            [4, 'vote', get_lang(conn, 'vote_authority')],
-            [4, 'captcha_one_check_five_pass', get_lang(conn, 'captcha_one_check_five_pass_authority')]
+                [2, 'captcha_pass', get_lang(conn, 'captcha_pass_authority')],
+                [2, 'ip', get_lang(conn, 'ip_authority')],
+                    [3, 'document', get_lang(conn, 'document_authority')],
+                        [4, 'edit', get_lang(conn, 'edit_authority')],
+                            [5, '', get_lang(conn, 'view_authority')],
+                        [4, 'edit_request', get_lang(conn, 'edit_request_authority')],
+                            [5, '', get_lang(conn, 'view_authority')],
+                        [4, 'move', get_lang(conn, 'move_authority')],
+                            [5, '', get_lang(conn, 'view_authority')],
+                        [4, 'new_make', get_lang(conn, 'new_make_authority')],
+                            [5, '', get_lang(conn, 'view_authority')],
+                        [4, 'delete', get_lang(conn, 'delete_authority')],
+                            [5, '', get_lang(conn, 'view_authority')],
+                        [4, 'view', get_lang(conn, 'view_authority')],
+                    [3, 'discuss', get_lang(conn, 'discuss_authority')],
+                    [3, 'upload', get_lang(conn, 'upload_authority')],
+                    [3, 'vote', get_lang(conn, 'vote_authority')],
+                    [3, 'captcha_one_check_five_pass', get_lang(conn, 'captcha_one_check_five_pass_authority')]
         ]
 
         if flask.request.method == 'POST':
@@ -70,12 +75,11 @@ def give_admin_groups(name = 'test'):
                 acl_list = [for_a[0] for for_a in acl_list]
                 
                 checked = ''
-                if for_a[1] in acl_list:
-                    checked = 'checked'
-
                 choice = '<input type="checkbox" ' + state + ' name="' + for_a[1] + '" ' + checked + '> ' + for_a[2]
-                if len(for_a) == 4:
+                if for_a[1] == '':
                     choice = for_a[2]
+                elif for_a[1] in acl_list:
+                    checked = 'checked'
 
                 data += '' + \
                     '<li class="opennamu_list_1" style="margin-left: ' + str(int(for_a[0]) * 20) + 'px;">' + \

+ 5 - 0
route/tool/func.py

@@ -762,6 +762,9 @@ def set_init_always(conn, ver_num, run_mode):
         curs.execute(db_change('delete from alist where name = "ip"'))
         curs.execute(db_change('insert into alist (name, acl) values ("ip", "ip")'))
 
+        curs.execute(db_change('delete from alist where name = "ban"'))
+        curs.execute(db_change('insert into alist (name, acl) values ("ban", "view")'))
+
         # 이미지 폴더 없으면 생성
         if not os.path.exists(load_image_url(conn)):
             os.makedirs(load_image_url(conn))
@@ -1175,6 +1178,8 @@ def get_lang(conn, data, safe = 0):
                 else:
                     return html.escape(lang[data])
 
+        print(data + ' (' + lang_name + ')')
+
         return html.escape(data + ' (' + lang_name + ')')
 
 # 하위 호환용

BIN
route_go/bin/main.amd64.exe


+ 2 - 0
route_go/route/tool/language.go

@@ -69,6 +69,8 @@ func Get_language(db *sql.DB, data string, safe bool) string {
 				return HTML_escape(lang_data[data])
 			}
 		} else {
+			log.Default().Println(data + " (" + language + ")")
+
 			return data + " (" + language + ")"
 		}
 	}