Skip to content

Commit

Permalink
add "Help us translate" link in i18n language
Browse files Browse the repository at this point in the history
  • Loading branch information
hatemhosny committed Nov 2, 2024
1 parent 68c1d27 commit 0302c73
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 4 deletions.
15 changes: 15 additions & 0 deletions src/livecodes/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2436,6 +2436,21 @@ const handleI18nMenu = () => {
li.appendChild(link);
i18nMenu.appendChild(li);
});
const sep = document.createElement('li');
sep.role = 'separator';
i18nMenu.appendChild(sep);
const contributeLi = document.createElement('li');
const contributeLink = document.createElement('a');
contributeLink.href =
'https://github.com/live-codes/livecodes/blob/develop/docs/docs/contribution/i18n.md';
contributeLink.textContent = window.deps.translateString(
'app.i18nMenu.helpTranslate',
'Help Us Translate',
);
contributeLink.target = '_blank';
contributeLink.rel = 'noopener noreferrer';
contributeLi.appendChild(contributeLink);
i18nMenu.appendChild(contributeLi);
menuContainer.appendChild(i18nMenu);
};

Expand Down
2 changes: 1 addition & 1 deletion src/livecodes/html/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
href="javascript:void(0)"
id="app-menu-button-i18n"
class="button hint--bottom"
data-hint="Change UI Language"
data-hint="UI Language"
data-i18n="app.i18nButton.hint"
data-i18n-prop="data-hint"
>
Expand Down
6 changes: 5 additions & 1 deletion src/livecodes/i18n/locales/en/translation.lokalise.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@
},
"app.i18nButton.hint": {
"notes": "",
"translation": "Change UI Language"
"translation": "UI Language"
},
"app.i18nMenu.helpTranslate": {
"notes": "",
"translation": "Help Us Translate"
},
"app.logo.title": {
"notes": "",
Expand Down
5 changes: 4 additions & 1 deletion src/livecodes/i18n/locales/en/translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ const translation = {
hint: 'Full Screen',
},
i18nButton: {
hint: 'Change UI Language',
hint: 'UI Language',
},
i18nMenu: {
helpTranslate: 'Help Us Translate',
},
logo: {
title: 'LiveCodes: Code Playground That Just Works!',
Expand Down
7 changes: 7 additions & 0 deletions src/livecodes/styles/inc-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,13 @@
svg {
font-size: var(--s14);
}

a[target='_blank']::after {
content: '\2197';
display: inline-block;
margin: 0 0.3em;
width: 0.7em;
}
}

.dropdown-menu li:not(li[role='separator']) {
Expand Down
2 changes: 1 addition & 1 deletion src/livecodes/styles/inc-modal.scss
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@
height: var(--s32);
margin: 1rem;
max-width: calc(100% - 2rem);
padding: 0 1rem;
padding: 0.1rem 1rem;
position: absolute;
top: 0;
width: 100%;
Expand Down

0 comments on commit 0302c73

Please sign in to comment.