diff --git a/example-config.json b/example-config.json
index 5757ee0..8033ad4 100755
--- a/example-config.json
+++ b/example-config.json
@@ -2,7 +2,7 @@
"seperator": "
",
"site_name": "My Blog",
"site_url": "https://example.com",
- "language": "en",
+ "language": "en-US",
"port": 8080,
"allow_signup": true,
"site_description": "Read my blogs!",
diff --git a/locales/en.json b/locales/en-GB.json
similarity index 98%
rename from locales/en.json
rename to locales/en-GB.json
index 5583d7f..ab12d12 100644
--- a/locales/en.json
+++ b/locales/en-GB.json
@@ -1,4 +1,5 @@
{
+ "quotes": "“”‘’",
"password": "Password",
"username": "Username",
"prettyname": "Prettyname",
diff --git a/locales/en-US.json b/locales/en-US.json
new file mode 100644
index 0000000..ab12d12
--- /dev/null
+++ b/locales/en-US.json
@@ -0,0 +1,39 @@
+{
+ "quotes": "“”‘’",
+ "password": "Password",
+ "username": "Username",
+ "prettyname": "Prettyname",
+ "description": "Description (social links, what you write about etc), supports markdown",
+ "title": "Title",
+ "post_content": "Post Content, supports markdown",
+ "tags": "Tags (comma seperated)",
+ "delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
+ "signup_agreement": "I agree to not post illegal or hateful content",
+ "comment": "Comment",
+ "submit": "Sumbit",
+
+ "signups_unavailable": "Sorry, this server does not allow signups",
+ "user_exists": "Sorry, this user already exists, try a different username",
+ "user_doesnt_exist": "Sorry, this user does not exist",
+ "comment_doesnt_exist": "This comment doesn't exist, this could be because the post it was attached to was deleted",
+ "post_doesnt_exist": "This post doesn't exist or was deleted",
+ "incorrect_password": "Incorrect Password",
+ "rss_disabled": "Sorry, RSS is disabled",
+ "atom_disabled": "Sorry, ATOM is disabled",
+
+ "rss_feed": "RSS Feed",
+ "atom_feed": "ATOM Feed",
+ "new_post": "New Post",
+ "edit_post": "Edit Post",
+ "sign_up": "Sign Up",
+ "edit_account": "Edit Account",
+ "permalink": "Permalink",
+ "written_by": "Written by",
+ "published": "Published",
+ "last_modified": "Last Modified",
+ "hitcount": "Hitcount",
+ "posts_tagged": "Posts Tagged",
+ "home_page": "Home Page",
+ "site_index": "Site Index",
+ "attribution": "Powered by blogger-nodejs: Source Code, license (WTFPL)"
+}
diff --git a/locales/template.json b/locales/template.json
new file mode 100644
index 0000000..ab12d12
--- /dev/null
+++ b/locales/template.json
@@ -0,0 +1,39 @@
+{
+ "quotes": "“”‘’",
+ "password": "Password",
+ "username": "Username",
+ "prettyname": "Prettyname",
+ "description": "Description (social links, what you write about etc), supports markdown",
+ "title": "Title",
+ "post_content": "Post Content, supports markdown",
+ "tags": "Tags (comma seperated)",
+ "delete_account_confirmation": "Delete my account - (I agree that my account and all of my posts will be permanently deleted instantly)",
+ "signup_agreement": "I agree to not post illegal or hateful content",
+ "comment": "Comment",
+ "submit": "Sumbit",
+
+ "signups_unavailable": "Sorry, this server does not allow signups",
+ "user_exists": "Sorry, this user already exists, try a different username",
+ "user_doesnt_exist": "Sorry, this user does not exist",
+ "comment_doesnt_exist": "This comment doesn't exist, this could be because the post it was attached to was deleted",
+ "post_doesnt_exist": "This post doesn't exist or was deleted",
+ "incorrect_password": "Incorrect Password",
+ "rss_disabled": "Sorry, RSS is disabled",
+ "atom_disabled": "Sorry, ATOM is disabled",
+
+ "rss_feed": "RSS Feed",
+ "atom_feed": "ATOM Feed",
+ "new_post": "New Post",
+ "edit_post": "Edit Post",
+ "sign_up": "Sign Up",
+ "edit_account": "Edit Account",
+ "permalink": "Permalink",
+ "written_by": "Written by",
+ "published": "Published",
+ "last_modified": "Last Modified",
+ "hitcount": "Hitcount",
+ "posts_tagged": "Posts Tagged",
+ "home_page": "Home Page",
+ "site_index": "Site Index",
+ "attribution": "Powered by blogger-nodejs: Source Code, license (WTFPL)"
+}
diff --git a/src/functions.js b/src/functions.js
index 210c084..1d91eb2 100644
--- a/src/functions.js
+++ b/src/functions.js
@@ -101,13 +101,15 @@ export function render_comment(comment_content) {
};
export function render_md(content) {
const markdownit = require("markdown-it")
+ const config = require("../config.json")
+ const locale = require(`../locales/${config.locale}.json`)
const md = markdownit({
html: false,
xhtmlOut: false,
breaks: true,
linkify: false,
typographer: true,
- quotes: true,
+ quotes: locale.quotes,
})
return md.render(content)
};
diff --git a/views/pages/timeline.ejs b/views/pages/timeline.ejs
index 1e7d401..15e3062 100644
--- a/views/pages/timeline.ejs
+++ b/views/pages/timeline.ejs
@@ -18,7 +18,7 @@
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<% if (posts[index]["deleted"] != true) { %>
- <%- include('../posts/timeline', {post: posts[index], index: index, user: users[posts[index].userID]}); %>
+ <%- include('../posts/timeline', {post: posts[index], postID: index, user: users[posts[index].userID]}); %>
<% } %>
<% } %>
diff --git a/views/pages/user.ejs b/views/pages/user.ejs
index 23c8af1..08eebd1 100644
--- a/views/pages/user.ejs
+++ b/views/pages/user.ejs
@@ -11,7 +11,7 @@
<% for (let index = posts.length - 1; index >= 0; index--) { %>
<% if (posts[index].userID == userID) { %>
- <%- include('../posts/user', {post: posts[index], index: index, user: user}); %>
+ <%- include('../posts/user', {post: posts[index], postID: index, user: user}); %>
<% } %>
<% } %>
diff --git a/views/posts/tag.ejs b/views/posts/tag.ejs
index 9fa19bf..b7fd07e 100644
--- a/views/posts/tag.ejs
+++ b/views/posts/tag.ejs
@@ -2,7 +2,7 @@
<%= post.title %>
<%- func.render_md(post.content) %>
-<%= locale.edit_post %>
+<%= locale.edit_post %>
<%= locale.permalink %>
<%- func.hyperlink_tags(post.tags) %>
diff --git a/views/posts/timeline.ejs b/views/posts/timeline.ejs
index e504d33..251c25a 100644
--- a/views/posts/timeline.ejs
+++ b/views/posts/timeline.ejs
@@ -2,8 +2,8 @@
<%= post.title %>
<%- func.render_md(post.content) %>
-<%= locale.edit_post %>
-<%= locale.permalink %>
+<%= locale.edit_post %>
+<%= locale.permalink %>
<%= locale.written_by %> <%= user.username %>
@@ -11,13 +11,13 @@
-<% comments[index].forEach((comment, index) => { %>
+<% comments[postID].forEach((comment, postID) => { %>
<%- include('../partials/comment', {comment: comment}) %>
<% }) %>
diff --git a/views/posts/user.ejs b/views/posts/user.ejs
index a6fb2db..ccb1984 100644
--- a/views/posts/user.ejs
+++ b/views/posts/user.ejs
@@ -2,19 +2,19 @@
<%= post.title %>
<%- func.render_md(post.content) %>
-<%= locale.edit_post %>
-<%= locale.permalink %>
+<%= locale.edit_post %>
+<%= locale.permalink %>
-<% comments[index].forEach((comment, index) => { %>
+<% comments[postID].forEach((comment, postID) => { %>
<%- include('../partials/comment', {comment: comment}) %>
<% }) %>