Просмотр исходного кода

Merge pull request #682 from weseek/feat/language-setting

Feat/global language setting
Yuki Takei 7 лет назад
Родитель
Сommit
b056713e0d
3 измененных файлов с 19 добавлено и 0 удалено
  1. 7 0
      src/server/models/config.js
  2. 8 0
      src/server/util/swigFunctions.js
  3. 4 0
      src/server/views/installer.html

+ 7 - 0
src/server/models/config.js

@@ -53,6 +53,7 @@ module.exports = function(crowi) {
       'app:confidential'  : '',
       'app:confidential'  : '',
 
 
       'app:fileUpload'    : false,
       'app:fileUpload'    : false,
+      'app:globalLang'    : 'en',
 
 
       'security:restrictGuestMode'      : 'Deny',
       'security:restrictGuestMode'      : 'Deny',
 
 
@@ -283,6 +284,11 @@ module.exports = function(crowi) {
     return getValueForCrowiNS(config, key) || 'GROWI';
     return getValueForCrowiNS(config, key) || 'GROWI';
   };
   };
 
 
+  configSchema.statics.globalLang = function(config) {
+    const key = 'app:globalLang';
+    return getValueForCrowiNS(config, key);
+  };
+
   configSchema.statics.isEnabledPassport = function(config) {
   configSchema.statics.isEnabledPassport = function(config) {
     // always true if growi installed cleanly
     // always true if growi installed cleanly
     if (Object.keys(config.crowi).length == 0) {
     if (Object.keys(config.crowi).length == 0) {
@@ -605,6 +611,7 @@ module.exports = function(crowi) {
       },
       },
       recentCreatedLimit: Config.showRecentCreatedNumber(config),
       recentCreatedLimit: Config.showRecentCreatedNumber(config),
       isAclEnabled: !Config.isPublicWikiOnly(config),
       isAclEnabled: !Config.isPublicWikiOnly(config),
+      globalLang: Config.globalLang(config),
     };
     };
 
 
     return local_config;
     return local_config;

+ 8 - 0
src/server/util/swigFunctions.js

@@ -49,6 +49,14 @@ module.exports = function(crowi, app, req, locals) {
     return crowi.xss.process(Config.appTitle(config));
     return crowi.xss.process(Config.appTitle(config));
   };
   };
 
 
+  /**
+   * return app-global language
+   */
+  locals.appGlobalLang = function() {
+    const config = crowi.getConfig();
+    return Config.globalLang(config);
+  };
+
   /**
   /**
    * return true if enabled
    * return true if enabled
    */
    */

+ 4 - 0
src/server/views/installer.html

@@ -49,6 +49,10 @@
         <small>初めに作成するアカウントは、自動的に管理者権限が付与されます</small>
         <small>初めに作成するアカウントは、自動的に管理者権限が付与されます</small>
       </p>
       </p>
 
 
+      <p class="alert alert-warning p-b-10 p-t-10">
+        <small>現在の言語設定: {{ appGlobalLang() }}</small>
+      </p>
+
       <form role="form" action="/installer/createAdmin" method="post" id="register-form">
       <form role="form" action="/installer/createAdmin" method="post" id="register-form">
 
 
         <div class="input-group" id="input-group-username">
         <div class="input-group" id="input-group-username">