Skip to content

Commit 267bbca

Browse files
authored
Merge branch 'develop' into updating-classnames-and-adding-types-classnames-npm-packages
2 parents de0e9ef + 70d22bb commit 267bbca

File tree

7 files changed

+56
-36
lines changed

7 files changed

+56
-36
lines changed

client/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export function languageKeyToLabel(lang) {
7070
it: 'Italiano',
7171
ja: '日本語',
7272
ko: '한국어',
73-
'pt-BR': 'Português',
73+
'pt-BR': 'Português do Brasil',
7474
sv: 'Svenska',
7575
'uk-UA': 'Українська',
7676
'zh-CN': '简体中文',

client/index.jsx

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import React, { Suspense } from 'react';
1+
import React, { Suspense, useEffect } from 'react';
22
import { render } from 'react-dom';
3-
import { Provider } from 'react-redux';
3+
import { Provider, useSelector } from 'react-redux';
44
import { Router } from 'react-router-dom';
55

66
import { useTranslation } from 'react-i18next';
@@ -21,6 +21,8 @@ const initialState = window.__INITIAL_STATE__;
2121

2222
const store = configureStore(initialState);
2323

24+
const DONATE_LOGO_IMAGE_URL = 'https://donorbox.org/images/white_logo.svg';
25+
2426
if (
2527
window.location.href.indexOf('full') === -1 &&
2628
window.location.href.indexOf('embed') === -1
@@ -56,30 +58,30 @@ if (
5658
'background: #f1678e; color: #fff; text-decoration: none; font-family: Verdana, sans-serif; display: flex; gap: 8px; width: fit-content; font-size: 16px; border-radius: 0 0 5px 5px; line-height: 24px; position: fixed; top: 50%; transform-origin: center; z-index: 9999; overflow: hidden; padding: 8px 22px 8px 18px; right: 20px; left: auto; transform: translate(50%, -50%) rotate(90deg)'
5759
);
5860
buttonScript.setAttribute('data-button-cta', 'Donate');
59-
buttonScript.setAttribute(
60-
'data-img-src',
61-
'https://donorbox.org/images/white_logo.svg'
62-
);
61+
buttonScript.setAttribute('data-img-src', DONATE_LOGO_IMAGE_URL);
6362

6463
document.body.appendChild(buttonScript);
6564
}
6665

6766
const App = () => {
6867
const { t } = useTranslation();
69-
70-
setTimeout(() => {
71-
const donateButton = document.getElementsByClassName(
72-
'dbox-donation-button'
73-
)[0];
74-
75-
if (donateButton) {
76-
const donateLogoImage = document.createElement('img');
77-
donateLogoImage.src = 'https://donorbox.org/images/white_logo.svg';
78-
79-
donateButton.text = t('About.Donate');
80-
donateButton.prepend(donateLogoImage);
81-
}
82-
}, 0);
68+
const language = useSelector((state) => state.preferences.language);
69+
70+
useEffect(() => {
71+
setTimeout(() => {
72+
const donateButton = document.getElementsByClassName(
73+
'dbox-donation-button'
74+
)[0];
75+
76+
if (donateButton) {
77+
const donateLogoImage = document.createElement('img');
78+
donateLogoImage.src = DONATE_LOGO_IMAGE_URL;
79+
80+
donateButton.text = t('About.Donate');
81+
donateButton.prepend(donateLogoImage);
82+
}
83+
}, 500);
84+
}, [language]);
8385

8486
return (
8587
<div>

client/modules/IDE/actions/project.js

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ export function deleteProject(id) {
413413
});
414414
};
415415
}
416-
export function changeVisibility(projectId, projectName, visibility) {
416+
export function changeVisibility(projectId, projectName, visibility, t) {
417417
return (dispatch, getState) => {
418418
const state = getState();
419419

@@ -443,11 +443,25 @@ export function changeVisibility(projectId, projectName, visibility) {
443443
name: response.data.name
444444
});
445445

446-
dispatch(
447-
setToastText(
448-
`${projectName} is now ${newVisibility.toLowerCase()}`
449-
)
450-
);
446+
let visibilityLabel;
447+
448+
switch (newVisibility) {
449+
case 'Public':
450+
visibilityLabel = t('Visibility.Public.Label');
451+
break;
452+
case 'Private':
453+
visibilityLabel = t('Visibility.Private.Label');
454+
break;
455+
default:
456+
visibilityLabel = newVisibility;
457+
}
458+
459+
const visibilityToastText = t('Visibility.Changed', {
460+
projectName,
461+
newVisibility: visibilityLabel.toLowerCase()
462+
});
463+
464+
dispatch(setToastText(visibilityToastText));
451465
dispatch(showToast(2000));
452466
}
453467
}

client/modules/IDE/components/Header/Toolbar.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const Toolbar = (props) => {
3333
const dispatch = useDispatch();
3434
const { t } = useTranslation();
3535
const userIsOwner = user?.username === project.owner?.username;
36-
3736
const showVisibilityDropdown = project?.owner && userIsOwner;
3837

3938
const playButtonClass = classNames({
@@ -51,7 +50,7 @@ const Toolbar = (props) => {
5150

5251
const handleVisibilityChange = useCallback(
5352
(sketchId, sketchName, newVisibility) => {
54-
dispatch(changeVisibility(sketchId, sketchName, newVisibility));
53+
dispatch(changeVisibility(sketchId, sketchName, newVisibility, t));
5554
},
5655
[changeVisibility]
5756
);

client/modules/IDE/components/SketchListRowBase.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const SketchListRowBase = ({
9191

9292
const handleVisibilityChange = useCallback(
9393
(sketchId, sketchName, newVisibility) => {
94-
changeVisibility(sketchId, sketchName, newVisibility);
94+
changeVisibility(sketchId, sketchName, newVisibility, t);
9595
},
9696
[changeVisibility]
9797
);

translations/locales/en-US/translations.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
"Reference": "Reference",
3030
"About": "About",
3131
"ReportBug": "Report a Bug",
32-
"ChatOnDiscord":"Chat On Discord",
33-
"PostOnTheForum":"Post on the Forum"
32+
"ChatOnDiscord": "Chat On Discord",
33+
"PostOnTheForum": "Post on the Forum"
3434
},
3535
"Lang": "Language",
3636
"BackEditor": "Back to Editor",
@@ -690,6 +690,7 @@
690690
"Private": {
691691
"Description": "Only you can see this sketch.",
692692
"Label": "Private"
693-
}
693+
},
694+
"Changed": "'{{projectName}}' is now {{newVisibility}}..."
694695
}
695696
}

translations/locales/pt-BR/translations.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@
2727
"Title": "Ajuda",
2828
"KeyboardShortcuts": "Atalhos de Teclado",
2929
"Reference": "Referência",
30-
"About": "Sobre"
30+
"About": "Sobre",
31+
"ReportBug": "Reportar um Erro",
32+
"ChatOnDiscord": "Conversar no Discord",
33+
"PostOnTheForum": "Postar no Fórum"
3134
},
3235
"BackEditor": "Voltar ao Editor",
3336
"WarningUnsavedChanges": "Realmente quer sair da página? Há mudanças não salvas.",
@@ -208,7 +211,7 @@
208211
"AutocompleteHinterOnARIA": "Geração de dicas do Autocompleter ativada",
209212
"AutocompleteHinterOffARIA": "Geração de dicas do Autocompleter desativada",
210213
"LibraryVersion": "Versão do p5.js",
211-
"LibraryVersionInfo": "Há uma [nova versão 2.0](https://github.com/processing/p5.js/releases/) do p5.js disponível! Ela se tornará padrão em agosto de 2026, então aproveite este tempo para testá-la e relatar bugs. Está interessado em transitar esboços de 1.x para 2.0? Confira os [recursos de compatibilidade e transição.](https://github.com/processing/p5.js-compatibility)",
214+
"LibraryVersionInfo": "Há uma [nova versão 2.0](https://github.com/processing/p5.js/releases/) do p5.js disponível! Ela se tornará padrão em agosto de 2026, então aproveite este tempo para testá-la e relatar erros. Está interessado em migrar esboços de 1.x para 2.0? Confira os [recursos de compatibilidade e migração.](https://github.com/processing/p5.js-compatibility)",
212215
"CustomVersionTitle": "Gerenciando suas próprias bibliotecas? Legal!",
213216
"CustomVersionInfo": "A versão do p5.js está atualmente sendo gerenciada no código do index.html. Isso significa que não pode ser ajustada a partir desta aba.",
214217
"CustomVersionReset": "Se você gostaria de usar as bibliotecas padrão, pode substituir as tags de script no index.html pelo seguinte:",
@@ -621,6 +624,7 @@
621624
"Private": {
622625
"Description": "Apenas você pode ver este esboço.",
623626
"Label": "Privado"
624-
}
627+
},
628+
"Changed": "'{{projectName}}' agora é {{newVisibility}}..."
625629
}
626630
}

0 commit comments

Comments
 (0)