Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation pt br #1238

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,10 @@ export default function GeneralPanelForm() {
<option value='it'>Italian</option>
<option value='no'>Norwegian</option>
<option value='pt'>Portuguese</option>
<option value='ptbr'>Português Brasil</option>
<option value='es'>Spanish</option>
<option value='sv'>Swedish</option>
<option value='pl'>Polish</option>
<option value='pl'>Polish</option>
Comment on lines +155 to +158
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Issue Detected: 'ptbr' Language Code Not Fully Integrated

The ptbr language code is added to the language selection dropdown but is not registered in the application's language configuration or localization files. This may prevent the application from properly handling Brazilian Portuguese language settings.

  • Action Required:
    • Register 'ptbr' in the language configuration files.
    • Add necessary localization entries for 'ptbr' to support Brazilian Portuguese translations.
🔗 Analysis chain

LGTM! The changes align with the PR objectives.

The addition of the "Português Brasil" option and the indentation fix for the "Polish" option improve the language selection capabilities and code consistency. These changes successfully implement the PR's goal of adding Brazilian Portuguese language support.

To ensure consistency with the application's language handling system, please verify that the 'ptbr' language code is correctly recognized and implemented throughout the application. Run the following script to check for its usage:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of 'ptbr' language code across the application

# Test: Search for 'ptbr' usage in TypeScript and JavaScript files
echo "Searching for 'ptbr' usage in TypeScript and JavaScript files:"
rg --type-add 'web:*.{ts,tsx,js,jsx}' --type web "'ptbr'" -g '!**/node_modules/**'

# Test: Search for other occurrences of 'Português Brasil' or similar
echo "Searching for other occurrences of 'Português Brasil' or similar:"
rg --type-add 'web:*.{ts,tsx,js,jsx}' --type web "Portugu[eê]s\s*Brasil" -g '!**/node_modules/**'

# Test: Check for language-related configuration files
echo "Checking for language-related configuration files:"
fd -e json -e yaml -e yml -e config "lang|locale|i18n"

Length of output: 930


Script:

#!/bin/bash
# Description: Verify 'ptbr' registration in language configuration and i18n setup

# Test: Search for 'ptbr' in language configuration files
echo "Searching for 'ptbr' in language configuration files:"
rg --type-add 'config:*.{json,yaml,yml}' --type config "'ptbr'" -g '!**/node_modules/**'

# Test: Search for 'ptbr' in localization or translation files
echo "Searching for 'ptbr' in localization or translation files:"
rg --type-add 'local:*.{json,ts}' --type local "'ptbr'" -g '!**/node_modules/**'

Length of output: 441

</Select>
</Panel.ListItem>
</Panel.ListGroup>
Expand Down
13 changes: 8 additions & 5 deletions apps/client/src/features/operator/status-bar/StatusBarTimers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import ClockTime from '../../viewers/common/clock-time/ClockTime';
import RunningTime from '../../viewers/common/running-time/RunningTime';

import styles from './StatusBar.module.scss';
import { useTranslation } from '../../../../../client/src/translation/TranslationProvider';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider simplifying the import path for useTranslation

The current import path '../../../../../client/src/translation/TranslationProvider' seems unnecessarily long and complex. This could make the code harder to maintain and may indicate an issue with the project structure or import resolution.

Consider simplifying this import path. You might be able to use a shorter path or set up path aliases in your project configuration to make imports more manageable. For example:

import { useTranslation } from '@/translation/TranslationProvider';

This assumes you've set up path aliases in your TypeScript or webpack configuration.


interface StatusBarTimersProps {
projectTitle: string;
Expand All @@ -25,6 +26,8 @@ export default function StatusBarTimers(props: StatusBarTimersProps) {
const timer = useTimer();
const { clock } = useClock();

const { getLocalizedString } = useTranslation();

const getTimeStart = (): MaybeNumber => {
if (firstStart === undefined) {
return null;
Expand Down Expand Up @@ -61,25 +64,25 @@ export default function StatusBarTimers(props: StatusBarTimersProps) {
<div className={styles.timers}>
{PlaybackIconComponent}
<div className={styles.timeNow}>
<span className={styles.label}>Time now</span>
<span className={styles.label}>{getLocalizedString('common.time_now')}</span>
<ClockTime className={styles.timer} value={clock} />
</div>
<div className={styles.elapsedTime}>
<span className={styles.label}>Elapsed time</span>
<span className={styles.label}>{getLocalizedString('common.elapsed_time')}</span>
<RunningTime className={styles.timer} value={timer.elapsed} />
</div>
<div className={styles.runningTime}>
<span className={styles.label}>Running timer</span>
<span className={styles.label}>{getLocalizedString('countdown.running')}</span>
<RunningTime className={styles.timer} value={timer.current} />
</div>

<span className={styles.title}>{projectTitle}</span>
<div className={styles.startTime}>
<span className={styles.label}>Scheduled start</span>
<span className={styles.label}>{getLocalizedString('common.scheduled_start')}</span>
<ClockTime className={styles.timer} value={getTimeStart()} />
</div>
<div className={styles.endTime}>
<span className={styles.label}>Scheduled end</span>
<span className={styles.label}>{getLocalizedString('common.scheduled_end')}</span>
<ClockTime className={styles.timer} value={getTimeEnd()} />
</div>
</div>
Expand Down
12 changes: 12 additions & 0 deletions apps/client/src/translation/TranslationProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { createContext, PropsWithChildren, useCallback, useContext } from 'react

import useSettings from '../common/hooks-query/useSettings';

import { langPtbr } from './languages/pt-br';
import { langDe } from './languages/de';
import { langEn } from './languages/en';
import { langEs } from './languages/es';
Expand All @@ -12,6 +13,7 @@ import { langNo } from './languages/no';
import { langPl } from './languages/pl';
import { langPt } from './languages/pt';
import { langSv } from './languages/sv';
import { Playback } from 'ontime-types';

const translationsList = {
en: langEn,
Expand All @@ -24,6 +26,7 @@ const translationsList = {
pt: langPt,
sv: langSv,
pl: langPl,
ptbr: langPtbr,
};

interface TranslationContextValue {
Expand Down Expand Up @@ -60,3 +63,12 @@ export const useTranslation = () => {
const { getLocalizedString } = useContext(TranslationContext);
return { getLocalizedString };
};
export interface StatusBarTimersProps {
projectTitle: string;
playback: Playback;
selectedEventId: string | null;
firstStart?: number;
firstId?: string;
lastEnd?: number;
lastId?: string;
}
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langDe: TranslationObject = {
'common.stage_timer': 'Bühnen-Timer',
'common.started_at': 'Gestartet am',
'common.time_now': 'Aktuelle Zeit',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Veranstaltung endete um',
'countdown.running': 'Veranstaltung läuft',
'countdown.select_event': 'Wählen Sie eine Veranstaltung aus, um sie zu verfolgen',
Expand Down
3 changes: 3 additions & 0 deletions apps/client/src/translation/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export const langEn = {
'common.stage_timer': 'Stage Timer',
'common.started_at': 'Started At',
'common.time_now': 'Time now',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Event ended at',
'countdown.running': 'Event running',
'countdown.select_event': 'Select an event to follow',
Expand All @@ -21,6 +22,8 @@ export const langEn = {
'timeline.done': 'done',
'timeline.due': 'due',
'timeline.followedby': 'Followed by',


};

export type TranslationObject = Record<keyof typeof langEn, string>;
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langEs: TranslationObject = {
'common.stage_timer': 'Temporizador de presentador',
'common.started_at': 'Iniciado en',
'common.time_now': 'Ahora',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Evento finalizado a las',
'countdown.running': 'Evento en curso',
'countdown.select_event': 'Seleccionar un evento para seguir',
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langFr: TranslationObject = {
'common.stage_timer': 'Minuteur de scène',
'common.started_at': 'Commencé à',
'common.time_now': 'Heure',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Évènement terminé à',
'countdown.running': 'Évènement en cours',
'countdown.select_event': 'Sélectionnez un évènement à suivre',
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/hu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langHu: TranslationObject = {
'common.stage_timer': 'Színpadi időzítő',
'common.started_at': 'Kezdődött',
'common.time_now': 'Jelenlegi idő',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Esemény véget ért',
'countdown.running': 'Esemény folyamatban',
'countdown.select_event': 'Válassza ki a követendő eseményt',
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langIt: TranslationObject = {
'common.stage_timer': 'Orologio Palco',
'common.started_at': 'Iniziato Alle',
'common.time_now': 'Ora attuale',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Evento finito alle',
'countdown.running': 'Evento in corso',
'countdown.select_event': 'Seleziona un evento da seguire',
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/no.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langNo: TranslationObject = {
'common.stage_timer': 'Scenetimer',
'common.started_at': 'Startet',
'common.time_now': 'Klokken nå',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Hendelse avsluttet',
'countdown.running': 'Hendelse pågår',
'countdown.select_event': 'Velg en hendelse å følge',
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langPl: TranslationObject = {
'common.stage_timer': 'Timer Scena',
'common.started_at': 'Rozpoczęte o',
'common.time_now': 'Aktualny czas',
'common.elapsed_time': 'Elapsed Time',
'countdown.ended': 'Zakończone o',
'countdown.running': 'Trwa',
'countdown.select_event': 'Wybierz event który chcesz śledzić',
Expand Down
27 changes: 27 additions & 0 deletions apps/client/src/translation/languages/pt-br.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TranslationObject } from './en';

export const langPtbr: TranslationObject = {
'common.expected_finish': 'TÉRMINO ESPERADO',
'common.minutes': 'min',
'common.now': 'AGORA',
'common.next': 'PRÓXIMO',
'common.public_message': 'MENSAGEM PÚBLICA',
'common.scheduled_start': 'INÍCIO PLANEJADO',
'common.scheduled_end': 'ENCERRAMENTO PLANEJADO',
'common.projected_start': 'INÍCIO PREVISTO',
'common.projected_end': 'ENCERRAMENTO PREVISTO',
'common.stage_timer': 'TEMPO DO APRESENTADOR',
'common.started_at': 'INICIADO ÀS',
'common.time_now': 'HORA ATUAL',
'common.elapsed_time': 'TEMPO CORRIDO',
'countdown.ended': 'EVENTO ENCERRADO ÀS',
'countdown.running': 'TEMPO RESTANTE',
'countdown.select_event': 'SELECIONE UM EVENTO PARA ACOMPANHAR',
'countdown.to_start': 'Tempo para Iniciar',
'countdown.waiting': 'Aguardando o Início do Evento',
'countdown.overtime': 'em tempo extra',
'timeline.live': 'AGORA',
'timeline.done': 'Concluído',
'timeline.due': 'Pendente',
'timeline.followedby': 'Seguido por',
};
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/pt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langPt: TranslationObject = {
'common.stage_timer': 'Temporizador do presentador',
'common.started_at': 'Iniciado em',
'common.time_now': 'Hora atual',
'common.elapsed_time': 'Elapsed Time',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Translation for 'common.elapsed_time' is in English, not Portuguese

The newly added translation for 'common.elapsed_time' is currently in English ('Elapsed Time') instead of Portuguese. This doesn't align with the purpose of this file, which is to provide Portuguese translations.

Please update the translation to Portuguese. A suggested translation could be:

-  'common.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Tempo decorrido',

Make sure to verify this translation with a native Portuguese speaker or a professional translator to ensure accuracy.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'common.elapsed_time': 'Elapsed Time',
'common.elapsed_time': 'Tempo decorrido',

'countdown.ended': 'Evento encerrado às',
'countdown.running': 'Evento em andamento',
'countdown.select_event': 'Selecione um evento para acompanhar',
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/translation/languages/sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const langSv: TranslationObject = {
'common.stage_timer': 'Timer för scenen',
'common.started_at': 'Började vid',
'common.time_now': 'Klockan nu',
'common.elapsed_time': 'Elapsed Time',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Incorrect translation: 'common.elapsed_time' is not in Swedish

The newly added translation for 'common.elapsed_time' is in English instead of Swedish. This is inconsistent with the rest of the file, which contains Swedish translations.

Please replace the English text with the correct Swedish translation. The Swedish phrase for "Elapsed Time" is "Förfluten tid". Here's the corrected line:

-  'common.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Förfluten tid',
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'common.elapsed_time': 'Elapsed Time',
'common.elapsed_time': 'Förfluten tid',

'countdown.ended': 'Evenemanget avslutades vid',
'countdown.running': 'Evenemang pågår',
'countdown.select_event': 'Välj ett evenemang att följa',
Expand Down