mirror of https://github.com/jumpserver/jumpserver
Merge pull request #10272 from jumpserver/pr@dev@perf_asset_task_i18n
perf: 优化资产任务的 i18npull/10276/head
commit
75724cbddb
|
@ -1,6 +1,11 @@
|
||||||
id: gather_facts_mongodb
|
id: gather_facts_mongodb
|
||||||
name: Gather facts from MongoDB
|
name: "{{ 'Gather facts from MongoDB' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- mongodb
|
- mongodb
|
||||||
method: gather_facts
|
method: gather_facts
|
||||||
|
i18n:
|
||||||
|
Gather facts from MongoDB:
|
||||||
|
zh: 从 MongoDB 获取信息
|
||||||
|
en: Gather facts from MongoDB
|
||||||
|
ja: MongoDBから事実を取得する
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
id: gather_facts_mysql
|
id: gather_facts_mysql
|
||||||
name: Gather facts from MySQL
|
name: "{{ 'Gather facts from MySQL' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- mysql
|
- mysql
|
||||||
- mariadb
|
- mariadb
|
||||||
method: gather_facts
|
method: gather_facts
|
||||||
|
i18n:
|
||||||
|
Gather facts from MySQL:
|
||||||
|
zh: 从 MySQL 获取信息
|
||||||
|
en: Gather facts from MySQL
|
||||||
|
ja: MySQLから事実を取得する
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
id: gather_facts_oracle
|
id: gather_facts_oracle
|
||||||
name: Gather facts from Oracle
|
name: "{{ 'Gather facts from Oracle' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- oracle
|
- oracle
|
||||||
method: gather_facts
|
method: gather_facts
|
||||||
|
i18n:
|
||||||
|
Gather facts from Oracle:
|
||||||
|
zh: 从 Oracle 获取信息
|
||||||
|
en: Gather facts from Oracle
|
||||||
|
ja: Oracleから事実を取得する
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
id: gather_facts_postgresql
|
id: gather_facts_postgresql
|
||||||
name: Gather facts for PostgreSQL
|
name: "{{ 'Gather facts for PostgreSQL' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- postgresql
|
- postgresql
|
||||||
method: gather_facts
|
method: gather_facts
|
||||||
|
i18n:
|
||||||
|
Gather facts for PostgreSQL:
|
||||||
|
zh: 从 PostgreSQL 获取信息
|
||||||
|
en: Gather facts for PostgreSQL
|
||||||
|
ja: PostgreSQLから事実を取得する
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
id: gather_facts_posix
|
id: gather_facts_posix
|
||||||
name: Gather posix facts
|
name: "{{ 'Gather posix facts' | trans }}"
|
||||||
category: host
|
category: host
|
||||||
type:
|
type:
|
||||||
- linux
|
- linux
|
||||||
- unix
|
- unix
|
||||||
method: gather_facts
|
method: gather_facts
|
||||||
|
i18n:
|
||||||
|
Gather posix facts:
|
||||||
|
zh: 从 Posix 主机获取信息
|
||||||
|
en: Gather posix facts
|
||||||
|
ja: Posixから事実を取得する
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
id: gather_facts_windows
|
id: gather_facts_windows
|
||||||
name: Gather facts windows
|
name: "{{ 'Gather facts windows' | trans }}"
|
||||||
version: 1
|
version: 1
|
||||||
method: gather_facts
|
method: gather_facts
|
||||||
category: host
|
category: host
|
||||||
type:
|
type:
|
||||||
- windows
|
- windows
|
||||||
|
i18n:
|
||||||
|
Gather facts windows:
|
||||||
|
zh: 从 Windows 获取信息
|
||||||
|
en: Gather facts windows
|
||||||
|
ja: Windowsから事実を取得する
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
id: mongodb_ping
|
id: mongodb_ping
|
||||||
name: Ping MongoDB
|
name: "{{ 'Ping MongoDB' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- mongodb
|
- mongodb
|
||||||
method: ping
|
method: ping
|
||||||
|
i18n:
|
||||||
|
Ping MongoDB:
|
||||||
|
zh: 测试 MongoDB 可连接性
|
||||||
|
en: Ping MongoDB
|
||||||
|
ja: MongoDBにPingする
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
id: mysql_ping
|
id: mysql_ping
|
||||||
name: Ping MySQL
|
name: "{{ 'Ping MySQL' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- mysql
|
- mysql
|
||||||
- mariadb
|
- mariadb
|
||||||
method: ping
|
method: ping
|
||||||
|
i18n:
|
||||||
|
Ping MySQL:
|
||||||
|
zh: 测试 MySQL 可连接性
|
||||||
|
en: Ping MySQL
|
||||||
|
ja: MySQLにPingする
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
id: oracle_ping
|
id: oracle_ping
|
||||||
name: Ping Oracle
|
name: "{{ 'Ping Oracle' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- oracle
|
- oracle
|
||||||
method: ping
|
method: ping
|
||||||
|
i18n:
|
||||||
|
Ping Oracle:
|
||||||
|
zh: 测试 Oracle 可连接性
|
||||||
|
en: Ping Oracle
|
||||||
|
ja: OracleにPingする
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
id: ping_postgresql
|
id: ping_postgresql
|
||||||
name: Ping PostgreSQL
|
name: "{{ 'Ping PostgreSQL' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- postgresql
|
- postgresql
|
||||||
method: ping
|
method: ping
|
||||||
|
i18n:
|
||||||
|
Ping PostgreSQL:
|
||||||
|
zh: 测试 PostgreSQL 可连接性
|
||||||
|
en: Ping PostgreSQL
|
||||||
|
ja: PostgreSQLにPingする
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
id: sqlserver_ping
|
id: sqlserver_ping
|
||||||
name: Ping SQLServer
|
name: "{{ 'Ping SQLServer' | trans }}"
|
||||||
category: database
|
category: database
|
||||||
type:
|
type:
|
||||||
- sqlserver
|
- sqlserver
|
||||||
method: ping
|
method: ping
|
||||||
|
i18n:
|
||||||
|
Ping SQLServer:
|
||||||
|
zh: 测试 SQLServer 可连接性
|
||||||
|
en: Ping SQLServer
|
||||||
|
ja: SQLServerにPingする
|
||||||
|
|
|
@ -8,6 +8,6 @@ method: ping
|
||||||
|
|
||||||
i18n:
|
i18n:
|
||||||
Posix ping:
|
Posix ping:
|
||||||
zh: Posix ping
|
zh: 测试 Posix 可连接性
|
||||||
en: Posix ping
|
en: Posix ping
|
||||||
ja: Posix ピング
|
ja: Posix ピング
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
id: win_ping
|
id: win_ping
|
||||||
name: Windows ping
|
name: "{{ 'Windows ping' | trans }}"
|
||||||
version: 1
|
version: 1
|
||||||
method: ping
|
method: ping
|
||||||
category: host
|
category: host
|
||||||
type:
|
type:
|
||||||
- windows
|
- windows
|
||||||
|
i18n:
|
||||||
|
Windows ping:
|
||||||
|
zh: 测试 Windows 可连接性
|
||||||
|
en: Windows ping
|
||||||
|
ja: Windows ピング
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import io
|
import io
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
from django.utils.translation import get_language
|
from django.conf import settings
|
||||||
from jinja2 import Environment
|
from jinja2 import Environment
|
||||||
|
|
||||||
|
|
||||||
def translate(i18n, key):
|
def translate(key, i18n):
|
||||||
lang = get_language()[:2]
|
lang = settings.LANGUAGE_CODE[:2]
|
||||||
lang_data = i18n.get(key, {})
|
lang_data = i18n.get(key, {})
|
||||||
return lang_data.get(lang, key)
|
return lang_data.get(lang, key)
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ def yaml_load_with_i18n(stream):
|
||||||
i18n = yaml_data.get('i18n', {})
|
i18n = yaml_data.get('i18n', {})
|
||||||
|
|
||||||
env = Environment()
|
env = Environment()
|
||||||
env.filters['trans'] = lambda key: translate(i18n, key)
|
env.filters['trans'] = lambda key: translate(key, i18n)
|
||||||
template = env.from_string(ori_text)
|
template = env.from_string(ori_text)
|
||||||
yaml_data = template.render()
|
yaml_data = template.render()
|
||||||
yaml_f = io.StringIO(yaml_data)
|
yaml_f = io.StringIO(yaml_data)
|
||||||
|
|
|
@ -146,6 +146,8 @@ only_system_permissions = (
|
||||||
('authentication', '*', '*', '*'),
|
('authentication', '*', '*', '*'),
|
||||||
('tickets', '*', '*', '*'),
|
('tickets', '*', '*', '*'),
|
||||||
('orgs', 'organization', 'view', 'rootorg'),
|
('orgs', 'organization', 'view', 'rootorg'),
|
||||||
|
('terminal', 'applet', '*', '*'),
|
||||||
|
('terminal', 'applethost', '*', '*'),
|
||||||
)
|
)
|
||||||
|
|
||||||
only_org_permissions = (
|
only_org_permissions = (
|
||||||
|
|
Loading…
Reference in New Issue