mirror of
https://github.com/facebook/docusaurus.git
synced 2025-07-03 01:47:46 +02:00
Integrate handling of translation tag into static html building, add default description to translate tags
This commit is contained in:
parent
ed648074f2
commit
30a8ff329a
4 changed files with 61 additions and 14 deletions
25
lib/server/translate.js
Normal file
25
lib/server/translate.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
/**
|
||||
* Copyright (c) 2017-present, Facebook, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This source code is licensed under the BSD-style license found in the
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*/
|
||||
|
||||
const siteConfig = require(CWD + "/siteConfig.js");
|
||||
|
||||
let language = "en";
|
||||
|
||||
function setLanguage(lang) {
|
||||
language = lang;
|
||||
}
|
||||
|
||||
function translate(str) {
|
||||
return siteConfig[language]["pages-strings"][str];
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setLanguage: setLanguage,
|
||||
translate: translate
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue