GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — :bug: fix build · SatsCzar/nullstack.github.io@9b44b88

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • i18n/en-US/components
    • Post.yml
  • package.json
  • src
    • Translatable.njs
  • tailwind.css
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎i18n/en-US/components/Post.yml‎

Copy file name to clipboardExpand all lines: i18n/en-US/components/Post.yml
Whitespace-only changes.
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"license": "ISC",
77
"devDependencies": {
88
"concurrently": "^7.2.0",
9-
"nullstack": "~0.16.0",
9+
"nullstack": "~0.17.2",
1010
"tailwindcss": "^3.0.0"
1111
},
1212
"scripts": {
Collapse file

‎src/Translatable.njs‎

Copy file name to clipboard
+12-10Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
import { readFileSync } from 'fs';
2-
import Nullstack from 'nullstack';
3-
import YAML from 'yaml';
1+
import { existsSync, readFileSync } from "fs";
2+
import Nullstack from "nullstack";
3+
import YAML from "yaml";
44

55
class Translatable extends Nullstack {
6-
76
static async geti18nByLocale({ locale }) {
8-
const [name] = this.name.split('_');
9-
const file = readFileSync(`i18n/${locale}/components/${name}.yml`, 'utf-8');
10-
return YAML.parse(file);
7+
const [name] = this.name.split("_");
8+
const translationPath = `i18n/${locale}/components/${name}.yml`;
9+
if (existsSync(translationPath)) {
10+
const file = readFileSync(translationPath, "utf-8");
11+
return YAML.parse(file);
12+
}
13+
return {};
1114
}
1215

1316
async initiate({ page, locale }) {
1417
this.locale = locale;
1518
this.i18n = await this.geti18nByLocale({ locale });
1619
if (this.i18n.title) {
1720
page.description = this.i18n.description;
18-
page.locale = locale || 'en-US';
21+
page.locale = locale || "en-US";
1922
}
2023
}
2124

@@ -30,7 +33,6 @@ class Translatable extends Nullstack {
3033
this.initiate();
3134
}
3235
}
33-
3436
}
3537

36-
export default Translatable;
38+
export default Translatable;

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.