mirror of
https://git.sr.ht/~cadence/bibliogram
synced 2025-12-20 04:48:48 +00:00
Create initial language support
Create support for languages, then reformat user, home, and post pages to use it, and create en and en-us language files.
This commit is contained in:
7
src/lang/utils/base.template.js
Normal file
7
src/lang/utils/base.template.js
Normal file
@@ -0,0 +1,7 @@
|
||||
// This file is a template.
|
||||
|
||||
const data = {
|
||||
// CONTENT
|
||||
}
|
||||
|
||||
module.exports = data
|
||||
51
src/lang/utils/base.txt
Normal file
51
src/lang/utils/base.txt
Normal file
@@ -0,0 +1,51 @@
|
||||
# Front page
|
||||
|
||||
# Top section
|
||||
go_to_profile
|
||||
go_to_post
|
||||
go_username_or_url
|
||||
go_shortcode_or_url
|
||||
go_button
|
||||
|
||||
# Bottom section
|
||||
about_bibliogram_header
|
||||
pug_about_bibliogram_content
|
||||
about_this_instance_header
|
||||
onion_site_available
|
||||
t_settings
|
||||
t_privacy_policy
|
||||
has_not_written_privacy_policy
|
||||
instance_not_blocked
|
||||
instance_partially_blocked
|
||||
instance_blocked
|
||||
rss_enabled
|
||||
rss_disabled
|
||||
external_links_header
|
||||
source_link
|
||||
matrix_link
|
||||
instances_link
|
||||
contact_link
|
||||
t_featured_profiles
|
||||
featured_profiles_whats_this
|
||||
html_featured_profiles_disclaimer
|
||||
|
||||
# User page
|
||||
|
||||
verified_badge_alt
|
||||
verified_badge_title
|
||||
post_counter_label
|
||||
outgoing_follows_counter_label
|
||||
incoming_follows_counter_label
|
||||
t_home
|
||||
tab_timeline
|
||||
tab_igtv
|
||||
next_page_button
|
||||
next_page_button_loading
|
||||
profile_is_private_notice
|
||||
no_posts_notice
|
||||
no_more_posts_notice
|
||||
fn_page_divider
|
||||
|
||||
# Post page
|
||||
|
||||
pug_post_timestamp
|
||||
28
src/lang/utils/build_base.js
Normal file
28
src/lang/utils/build_base.js
Normal file
@@ -0,0 +1,28 @@
|
||||
const fs = require("fs").promises
|
||||
const pj = require("path").join
|
||||
|
||||
;(async () => {
|
||||
const contents = await fs.readFile(pj(__dirname, "base.txt"), "utf8")
|
||||
const lines = contents.split("\n")
|
||||
let template = await fs.readFile(pj(__dirname, "base.template.js"), "utf8")
|
||||
|
||||
template = template
|
||||
.replace("// This file is a template.", "// This file was automatically generated and its contents will be overwritten later.")
|
||||
.replace("// CONTENT", lines
|
||||
.filter(l => l && !l.startsWith("#"))
|
||||
.map(l => {
|
||||
if (l.startsWith("pug_")) {
|
||||
return `"${l}": locals => "MISSING TEMPLATE: ${l}"`
|
||||
} else if (l.startsWith("fn_")) {
|
||||
return `"${l}": () => "MISSING FUNCTION: ${l}"`
|
||||
} else {
|
||||
return `"${l}": "MISSING STRING: ${l}"`
|
||||
}
|
||||
})
|
||||
.join(",\n\t")
|
||||
)
|
||||
|
||||
await fs.writeFile(pj(__dirname, "../base.js"), template, "utf8")
|
||||
|
||||
console.log("base.js written.")
|
||||
})()
|
||||
Reference in New Issue
Block a user