Add some more simple translations, translate (You)'s and Settings button as proof of concept of translation in JS and CSS

indiachan-spamvector
Thomas Lynch 1 year ago
parent a019006e20
commit 21a181d3fa
  1. 4
      gulp/res/css/style.css
  2. 4
      gulp/res/js/yous.js
  3. 15
      locales/en.json
  4. 13
      locales/pt.json
  5. 12
      views/includes/navbar.pug
  6. 6
      views/includes/postform.pug
  7. 10
      views/mixins/boardnav.pug
  8. 18
      views/mixins/globalmanagenav.pug
  9. 2
      views/pages/thread.pug

@ -208,7 +208,7 @@ pre {
cursor: pointer;
}
#settings::after {
content: "Settings";
content: attr(data-label);
}
.expand-omitted {
background-color: var(--post-color);
@ -1112,7 +1112,7 @@ input:invalid, textarea:invalid {
.you:after {
margin-left: 3px;
content: '(You)';
content: '(' attr(data-label) ')';
font-weight: lighter;
font-style: italic;
}

@ -1,4 +1,4 @@
/* globals setLocalStorage */
/* globals __ setLocalStorage */
let notificationsEnabled = localStorage.getItem('notifications') == 'true';
let notificationYousOnly = localStorage.getItem('notification-yous-only') == 'true';
let yousEnabled = localStorage.getItem('yous-setting') == 'true';
@ -9,6 +9,7 @@ const toggleAllYous = (state) => savedYous.forEach(y => toggleOne(y, state));
const toggleQuotes = (quotes, state) => {
quotes.forEach(q => {
q[state?'setAttribute':'removeAttribute']('data-label', __('You'));
q.classList[state?'add':'remove']('you');
});
};
@ -19,6 +20,7 @@ const toggleOne = (you, state) => {
if (post) {
const postName = post.querySelector('.post-name');
if (postName) {
postName[state?'setAttribute':'removeAttribute']('data-label', __('You'));
postName.classList[state?'add':'remove']('you');
}
}

@ -7,6 +7,17 @@
"Accounts": "Accounts",
"Roles": "Roles",
"News": "News",
"Home": "Home",
"Overboard": "Overboard",
"Account": "Account",
"Manage": "Manage",
"Catalog": "Catalog",
"Banners": "Banners",
"Archive": "Archive",
"Settings": "Settings",
"Name": "Name"
}
"New Thread": "New Thread",
"New Reply": "New Reply",
"Name": "Name",
"You": "You",
"Index": "Index"
}

@ -7,6 +7,17 @@
"Accounts": "Contas",
"Roles": "Permissões",
"News": "Notícias",
"Home": "Início",
"Overboard": "Tudo",
"Account": "Conta",
"Manage": "Gerir",
"Catalog": "Catálogo",
"Banners": "Banners",
"Archive": "Arquivo",
"Settings": "Opções",
"Name": "Nome"
"New Thread": "Novo Fio",
"New Reply": "Nova Resposta",
"Name": "Nome",
"You": "You",
"Index": "Index"
}

@ -1,12 +1,12 @@
unless minimal
nav.navbar
a.nav-item(href='/index.html') Home
a.nav-item(href='/index.html') #{__('Home')}
a(href='/boards.html' class=`nav-item ${enableWebring ? 'short-nav' : ''}`)
| Boards
| #{__('Boards')}
if enableWebring
.rainbow +Webring
a.nav-item#overboardlink(href='/overboard.html') Overboard
a.nav-item(href='/account.html') Account
a.nav-item#overboardlink(href='/overboard.html') #{__('Overboard')}
a.nav-item(href='/account.html') #{__('Account')}
if !modview && board
a.nav-item(href=`/${board._id}/manage/${managePage || 'index.html'}`) Manage
a.jsonly.nav-item.right#settings
a.nav-item(href=`/${board._id}/manage/${managePage || 'index.html'}`) #{__('Manage')}
a.jsonly.nav-item.right#settings(data-label=(__('Settings')))

@ -9,7 +9,7 @@ section.form-wrapper.flex-center
input(type='hidden' name='_csrf' value=csrf)
input(type='hidden' name='thread' value=isThread ? thread.postId : null)
section.row.jsonly
.noselect#postform-dragHandle #{isThread ? 'New Reply' : 'New Thread'}
.noselect#postform-dragHandle #{isThread ? __('New Reply') : __('New Thread')}
if board.settings.forceAnon && !modview
section.row
.label Sage
@ -19,7 +19,7 @@ section.form-wrapper.flex-center
include ./subjectfield.pug
else
section.row
.label #{__("Name")}
.label #{__('Name')}
input.mr-1(type='text', name='name', placeholder=board.settings.defaultName maxlength=globalLimits.fieldLength.name)
a.close.postform-style(href='#!') ×
if board.settings.sageOnlyEmail && !modview
@ -89,4 +89,4 @@ section.form-wrapper.flex-center
else
include ./captchaexpand.pug
input#submitpost(type='submit', value=`New ${isThread ? 'Reply' : 'Thread'}`)
a.collapse.no-decoration.post-button(href='#postform') [#{isThread ? 'New Reply' : 'New Thread'}]
a.collapse.no-decoration.post-button(href='#postform') [#{isThread ? __('New Reply') : __('New Reply')}]

@ -1,14 +1,14 @@
mixin boardnav(selected, showIndex, upLevel)
if showIndex
|
a(href=`${upLevel ? '../' : ''}index.html` class=(selected === 'index' ? 'bold' : '')) [Index]
a(href=`${upLevel ? '../' : ''}index.html` class=(selected === 'index' ? 'bold' : '')) [#{__('Index')}]
|
a(href=`${upLevel ? '../' : ''}catalog.html` class=(selected === 'catalog' ? 'bold' : '')) [Catalog]
a(href=`${upLevel ? '../' : ''}catalog.html` class=(selected === 'catalog' ? 'bold' : '')) [#{__('Catalog')}]
if board.settings != null && board.settings.hideBanners === false
|
a(href=`${upLevel ? '../' : ''}banners.html` class=(selected === 'banners' ? 'bold' : '')) [Banners]
a(href=`${upLevel ? '../' : ''}banners.html` class=(selected === 'banners' ? 'bold' : '')) [#{__('Banners')}]
|
a(href=`${upLevel ? '../' : ''}logs.html` class=(selected === 'logs' ? 'bold' : '')) [Logs]
a(href=`${upLevel ? '../' : ''}logs.html` class=(selected === 'logs' ? 'bold' : '')) [#{__('Logs')}]
if thread != null && board.settings != null && board.settings.archiveLinks === true
|
a(href=`${archiveLinksURL.replace('%s', encodeURIComponent(meta.url+'/'+thread.board+'/thread/'+thread.postId+'.html'))}` rel='nofollow' referrerpolicy='same-origin' target='_blank') [Archive]
a(href=`${archiveLinksURL.replace('%s', encodeURIComponent(meta.url+'/'+thread.board+'/thread/'+thread.postId+'.html'))}` rel='nofollow' referrerpolicy='same-origin' target='_blank') [#{__('Archive')}]

@ -1,28 +1,28 @@
mixin globalmanagenav(selected, upLevel)
nav.pages
if permissions.get(Permissions.MANAGE_GLOBAL_GENERAL)
a(href=`${upLevel ? '../' : ''}recent.html` class=(selected === 'recent' ? 'bold' : '')) [#{__("Recent")}]
a(href=`${upLevel ? '../' : ''}recent.html` class=(selected === 'recent' ? 'bold' : '')) [#{__('Recent')}]
|
a(href=`${upLevel ? '../' : ''}reports.html` class=(selected === 'reports' ? 'bold' : '')) [#{__("Reports")}]
a(href=`${upLevel ? '../' : ''}reports.html` class=(selected === 'reports' ? 'bold' : '')) [#{__('Reports')}]
if permissions.get(Permissions.MANAGE_GLOBAL_BANS)
|
a(href=`${upLevel ? '../' : ''}bans.html` class=(selected === 'bans' ? 'bold' : '')) [#{__("Bans")}]
a(href=`${upLevel ? '../' : ''}bans.html` class=(selected === 'bans' ? 'bold' : '')) [#{__('Bans')}]
if permissions.get(Permissions.MANAGE_GLOBAL_BOARDS)
|
a(href=`${upLevel ? '../' : ''}boards.html` class=(selected === 'boards' ? 'bold' : '')) [#{__("Boards")}]
a(href=`${upLevel ? '../' : ''}boards.html` class=(selected === 'boards' ? 'bold' : '')) [#{__('Boards')}]
if permissions.get(Permissions.MANAGE_GLOBAL_LOGS)
|
a(href=`${upLevel ? '../' : ''}globallogs.html` class=(selected === 'logs' ? 'bold' : '')) [#{__("Logs")}]
a(href=`${upLevel ? '../' : ''}globallogs.html` class=(selected === 'logs' ? 'bold' : '')) [#{__('Logs')}]
if permissions.get(Permissions.MANAGE_GLOBAL_ACCOUNTS)
|
a(href=`${upLevel ? '../' : ''}accounts.html` class=(selected === 'accounts' ? 'bold' : '')) [#{__("Accounts")}]
a(href=`${upLevel ? '../' : ''}accounts.html` class=(selected === 'accounts' ? 'bold' : '')) [#{__('Accounts')}]
if permissions.get(Permissions.MANAGE_GLOBAL_ROLES)
|
a(href=`${upLevel ? '../' : ''}roles.html` class=(selected === 'roles' ? 'bold' : '')) [#{__("Roles")}]
a(href=`${upLevel ? '../' : ''}roles.html` class=(selected === 'roles' ? 'bold' : '')) [#{__('Roles')}]
if permissions.get(Permissions.MANAGE_GLOBAL_NEWS)
|
a(href=`${upLevel ? '../' : ''}news.html` class=(selected === 'news' ? 'bold' : '')) [#{__("News")}]
a(href=`${upLevel ? '../' : ''}news.html` class=(selected === 'news' ? 'bold' : '')) [#{__('News')}]
if permissions.get(Permissions.MANAGE_GLOBAL_SETTINGS)
|
a(href=`${upLevel ? '../' : ''}settings.html` class=(selected === 'settings' ? 'bold' : '')) [#{__("Settings")}]
a(href=`${upLevel ? '../' : ''}settings.html` class=(selected === 'settings' ? 'bold' : '')) [#{__('Settings')}]

@ -56,7 +56,7 @@ block content
if thread.replyposts >= board.settings.replyLimit && !thread.cyclic && !modview
p.title.text-center ⊖ Thread has reached reply limit.
else
a.bottom-reply.no-decoration.post-button(href='#postform') [New Reply]
a.bottom-reply.no-decoration.post-button(href='#postform') [#{__('New Reply')}]
hr(size=1)
.wrapbar
if modview

Loading…
Cancel
Save