Skip to content

Commit addecbd

Browse files
committed
"lang" attribute of the HTML tag dynamic
1 parent 412d1ed commit addecbd

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

assets/template.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!DOCTYPE html>
2-
<html lang="en">
2+
<html lang="<%= lang %>">
33
<head>
44
<!-- Simple HttpErrorPages | MIT License | https://github.com/HttpErrorPages -->
55
<meta charset="utf-8" /><meta http-equiv="X-UA-Compatible" content="IE=edge" /><meta name="viewport" content="width=device-width, initial-scale=1" />

bin/generator.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@ async function generator(configFilename, pageDefinitionFile, distPath){
2626
// load css
2727
const css = await _fs.readFile(cssPath, 'utf8');
2828

29+
const lang = pageDefinitionFile.substr(-10, 2);
30+
2931
console.log('Create/Empty distribution folder: "'+distPath+'"\n');
3032

31-
if(_fs.exists(distPath)) {
33+
if(await _fs.exists(distPath)) {
3234
await _fs.rmrf(distPath);
3335
}
3436
await _fs.mkdirp(distPath);
@@ -43,9 +45,12 @@ async function generator(configFilename, pageDefinitionFile, distPath){
4345
// inject errorcode
4446
pconf.code = p;
4547

46-
// inject foote
48+
// inject footer
4749
pconf.footer = pconf.footer || config.footer;
4850

51+
// inject footer
52+
pconf.lang = lang || 'en';
53+
4954
// render page
5055
const content = await _pageRenderer(tpl, css, pconf);
5156

0 commit comments

Comments
 (0)