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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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('commom.elapsed_time')}</span>
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

Fix typo in localization key for "Elapsed time"

There's a typo in the localization key for the "Elapsed time" label. The current key is 'commom.elapsed_time', which should be 'common.elapsed_time'.

Please correct the typo to ensure proper translation:

-        <span className={styles.label}>{getLocalizedString('commom.elapsed_time')}</span>
+        <span className={styles.label}>{getLocalizedString('common.elapsed_time')}</span>
📝 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
<span className={styles.label}>{getLocalizedString('commom.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',
'commom.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

Fix typo and provide German translation for 'elapsed time'

There are a few issues with this new translation entry:

  1. There's a typo in the key: 'commom' should be 'common'.
  2. The translation is in English, not German.
  3. This change seems unrelated to the PR's objective of adding Brazilian Portuguese translations.

Please apply the following changes:

-  'commom.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Verstrichene Zeit',

Also, consider moving this addition to a separate PR focused on updating German translations, as it's unrelated to the current PR's objective of adding Brazilian Portuguese support.

📝 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
'commom.elapsed_time': 'Elapsed Time',
'common.elapsed_time': 'Verstrichene Zeit',

'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
1 change: 1 addition & 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',
'commom.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

Fix typo in the new translation key

There's a typo in the newly added translation key. It should be 'common.elapsed_time' instead of 'commom.elapsed_time'.

Please apply the following change:

-  'commom.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Elapsed Time',

This will ensure consistency with other keys in the object that use 'common' as a prefix.

📝 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
'commom.elapsed_time': 'Elapsed Time',
'common.elapsed_time': 'Elapsed Time',

'countdown.ended': 'Event ended at',
'countdown.running': 'Event running',
'countdown.select_event': 'Select an event to follow',
Expand Down
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',
'commom.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

Fix typographical error and provide Spanish translation

There are a few issues with the new translation entry:

  1. There's a typographical error in the key: 'commom' should be 'common'.
  2. The value 'Elapsed Time' is in English, not Spanish.
  3. This inconsistency breaks the pattern established by other entries.

Please apply the following changes:

-  'commom.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Tiempo transcurrido',

This correction:

  • Fixes the typo in the key
  • Provides the correct Spanish translation
  • Maintains consistency with other entries in the file
📝 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
'commom.elapsed_time': 'Elapsed Time',
'common.elapsed_time': 'Tiempo transcurrido',

'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',
'commom.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ő',
'commom.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.

💡 Codebase verification

⚠️ Potential issue

Fix the key typo across all translation files and ensure proper translations

The key 'commom.elapsed_time' contains a typo and should be corrected to 'common.elapsed_time' in all translation files. Additionally, ensure that the value for each language is appropriately translated.

Issues Identified:

  1. Key Typo:

    • 'commom.elapsed_time' should be 'common.elapsed_time' in all files:
      • pl.ts
      • pt-br.ts
      • no.ts
      • it.ts
      • fr.ts
      • hu.ts
      • en.ts
      • es.ts
      • de.ts
  2. Incomplete Translations:

    • Except for pt-br.ts, the value 'Elapsed Time' is in English. These should be translated to the respective languages.

Suggested Changes:

-  'commom.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': '<Translated Value>',

Replace <Translated Value> with the appropriate translation for each language.

🔗 Analysis chain

Correct the key typo and provide Hungarian translation

There are two issues with the newly added translation:

  1. The key contains a typo: 'commom.elapsed_time' should be 'common.elapsed_time'.
  2. The value 'Elapsed Time' is in English, not Hungarian, which is inconsistent with the rest of the file.

Please apply the following changes:

  1. Correct the key spelling.
  2. Provide the Hungarian translation for 'Elapsed Time'.

Here's a suggested correction (please verify the Hungarian translation):

-  'commom.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Eltelt idő',

To ensure consistency across the codebase, let's check for any other occurrences of 'elapsed_time' in translation files:

This will help us verify if the correct key is used in other language files and if they all have proper translations.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for 'elapsed_time' in all translation files
rg --type typescript 'elapsed_time' apps/client/src/translation/languages/

Length of output: 109


Script:

#!/bin/bash
# Search for 'elapsed_time' in all TypeScript translation files
rg --type ts 'elapsed_time' apps/client/src/translation/languages/

Length of output: 835

'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',
'commom.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.

💡 Codebase verification

⚠️ Potential issue

Fix typos and translations across all language files

Several issues were found with the translation keys and values across multiple language files:

  1. Typo in key: The key 'commom.elapsed_time' should be corrected to 'common.elapsed_time' in all language files to maintain consistency.
  2. Missing translations: The value for 'commom.elapsed_time' is in English ('Elapsed Time') instead of the respective languages, except for pt-br.ts which has the correct Portuguese translation.

Affected files:

  • apps/client/src/translation/languages/pt-br.ts
  • apps/client/src/translation/languages/pl.ts
  • apps/client/src/translation/languages/no.ts
  • apps/client/src/translation/languages/it.ts
  • apps/client/src/translation/languages/fr.ts
  • apps/client/src/translation/languages/hu.ts
  • apps/client/src/translation/languages/en.ts
  • apps/client/src/translation/languages/es.ts
  • apps/client/src/translation/languages/de.ts

Actions needed:

  1. Correct the key to 'common.elapsed_time' in all affected language files.
  2. Provide appropriate translations for 'Elapsed Time' in each language file to ensure proper localization.

Suggested correction example:

-  'commom.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Tempo trascorso',
🔗 Analysis chain

Fix typo and translation, and clarify relevance to PR objectives

There are several issues with this new addition:

  1. There's a typo in the key: 'commom' should be 'common' to maintain consistency with other keys.
  2. The value 'Elapsed Time' is in English, not Italian. It should be translated to Italian.
  3. This change doesn't seem to align with the PR objectives of adding Brazilian Portuguese translations and translator codes.

Please address these issues:

  1. Correct the key to 'common.elapsed_time'.
  2. Translate 'Elapsed Time' to Italian.
  3. Clarify how this change relates to the PR objectives or consider removing it if it's not relevant.

Here's a suggested correction for the Italian translation:

-  'commom.elapsed_time': 'Elapsed Time',
+  'common.elapsed_time': 'Tempo trascorso',

To ensure consistency and completeness, let's check for similar keys in other language files:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for 'elapsed_time' key in all language files
rg --type typescript 'elapsed_time' apps/client/src/translation/languages/

Length of output: 564


Script:

#!/bin/bash
# Search for both correct and incorrect 'elapsed_time' keys in all TypeScript language files
rg --type typescript '(commom|common)\.elapsed_time' apps/client/src/translation/languages/

Length of output: 128


Script:

#!/bin/bash
# Search for both correct and incorrect 'elapsed_time' keys in all TypeScript (.ts) language files
rg -g "*.ts" '(commom|common)\.elapsed_time' apps/client/src/translation/languages/

Length of output: 854

'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å',
'commom.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',
'commom.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',
'commom.elapsed_time': 'TEMPO CORRIDO',
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

Fix typo in translation key.

There's a typo in the key 'commom.elapsed_time'. It should be 'common.elapsed_time'.

Please apply the following change:

-  'commom.elapsed_time': 'TEMPO CORRIDO',
+  'common.elapsed_time': 'TEMPO CORRIDO',
📝 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
'commom.elapsed_time': 'TEMPO CORRIDO',
'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',
};