mirror of
https://github.com/facebook/docusaurus.git
synced 2025-04-28 17:57:48 +02:00
Fixes #104 by providing a useful error message.
Next step will be to run 'write-translations' on 'yarn start' and 'yarn build' (#119)
This commit is contained in:
parent
a1810c99fc
commit
8ac191a331
2 changed files with 14 additions and 0 deletions
|
@ -27,6 +27,18 @@ function setLanguage(lang) {
|
|||
}
|
||||
|
||||
function translate(str) {
|
||||
if (
|
||||
!translation[language] ||
|
||||
!translation[language]["pages-strings"] ||
|
||||
!translation[language]["pages-strings"][str]
|
||||
) {
|
||||
throw new Error(
|
||||
"Text that you've identified for translation hasn't been added to the global list in 'en.json'. To solve this problem run 'yarn write-translations'."
|
||||
);
|
||||
}
|
||||
console.log(translation[language]);
|
||||
console.log(translation[language]["pages-strings"]);
|
||||
console.log(translation[language]["pages-strings"][str]);
|
||||
return parseEscapeSequences(translation[language]["pages-strings"][str]);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@ function writeFileAndCreateFolder(file, content) {
|
|||
}
|
||||
|
||||
function execute() {
|
||||
console.log("Writing translation files...");
|
||||
|
||||
let translations = {
|
||||
"localized-strings": {
|
||||
next: "Next",
|
||||
|
|
Loading…
Add table
Reference in a new issue