Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,15 @@
"dom-to-image": "^2.6.0",
"electron-window-state": "^5.0.3",
"font-gis": "^1.0.6",
"i18next": "^24.2.3",
"leaflet": "^1.9.4",
"leaflet.nauticscale": "^1.1.0",
"leaflet.polylinemeasure": "^3.0.0",
"lodash": "^4.17.21",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-error-boundary": "^5.0.0",
"react-i18next": "^15.4.1",
"react-leaflet": "^5.0.0",
"react-leaflet-custom-control": "^1.4.0",
"react-leaflet-geoman-v2": "^1.0.1",
Expand Down
25 changes: 25 additions & 0 deletions src/components/WelcomePage/LanguageSelector.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// src/components/WelcomePage/LanguageSelector.tsx
import React from 'react'
import { useTranslation } from 'react-i18next'

const LanguageSelector: React.FC = () => {
const { i18n } = useTranslation()

const changeLanguage = (event: React.ChangeEvent<HTMLSelectElement>) => {
const newLang = event.target.value
i18n.changeLanguage(newLang).then(() => {
// Force a re-render of the entire app
window.location.reload()
})
}

return (
<select onChange={changeLanguage} value={i18n.language}>
<option value="en">English</option>
<option value="it">Italiano</option>
Copy link

Copilot AI Apr 4, 2025

Choose a reason for hiding this comment

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

[nitpick] The LanguageSelector component does not include an option for Dutch ('nl') despite the i18n configuration providing Dutch translations. Consider adding a Dutch option to align with the available languages.

Suggested change
<option value="it">Italiano</option>
<option value="it">Italiano</option>
<option value="nl">Nederlands</option>

Copilot uses AI. Check for mistakes.
<option value="nl">Nederlands</option>
</select>
)
}

export default LanguageSelector
25 changes: 15 additions & 10 deletions src/components/WelcomePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// src/components/WelcomePage/index.tsx
import { Button, Col, Image, Row, Typography } from 'antd'
import './styles.css'
import { useTranslation } from 'react-i18next'
import LanguageSelector from './LanguageSelector'

interface WelcomePageProps {
onDragOver: (event: React.DragEvent<HTMLDivElement>) => void
Expand All @@ -16,48 +19,50 @@ const WelcomePage: React.FC<WelcomePageProps> = ({
handleNew,
openExistingDocument
}) => {
// Get debug information from environment variables
const { t } = useTranslation()
const gitBranch = import.meta.env.VITE_GIT_BRANCH || 'unknown'
const buildDate = import.meta.env.VITE_BUILD_DATE
? new Date(import.meta.env.VITE_BUILD_DATE).toLocaleString()
: 'unknown'
return (
<div style={{ paddingTop: '50px' }} onDragOver={onDragOver} onDragLeave={onDragLeave} onDrop={onDrop}>
<Row>
<Col span={24}><Typography.Title>Welcome to Albatross</Typography.Title></Col>
<Col span={24}><Typography.Title>{t('welcomeToAlbatross')}</Typography.Title></Col>
</Row>
<Row>
<Col span={24}>&nbsp;</Col>
</Row>
<Row align='middle' justify='start'>
<Col span={12}>
<Image alt='Application logo - albatross flying' preview={false} width={200} src='images/albatross-flying.png' />
<Image alt={t('applicationLogoAlt')} preview={false} width={200} src='images/albatross-flying.png' />
</Col>
<Col span={12}>
<Row style={{ paddingBottom: '12px' }}>
<Col span={6}>&nbsp;</Col>
<Col span={12}><Typography.Text type='secondary'>Open an existing document or create a new one</Typography.Text></Col>
<Col span={12}><Typography.Text type='secondary'>{t('openOrCreateDocument')}</Typography.Text></Col>
</Row>
<Row>
<Col span={6}></Col>
<Col span={12}>
<Button onClick={() => handleNew(false)} size='large' type='primary'>New</Button>
<Button style={{fontStyle: 'italic', marginLeft: '10px'}} onClick={() => handleNew(true)} size='large' type='primary'>Sample plot</Button>
<Button onClick={() => handleNew(false)} size='large' type='primary'>{t('new')}</Button>
<Button style={{fontStyle: 'italic', marginLeft: '10px'}} onClick={() => handleNew(true)} size='large' type='primary'>{t('samplePlot')}</Button>
</Col>
</Row>
<Row style={{ paddingTop: '25px' }}>
<Col span={8}></Col>
<Col span={8}><Button onClick={openExistingDocument} size='large' block type='primary'>Open</Button></Col>
<Col span={8}><Button onClick={openExistingDocument} size='large' block type='primary'>{t('open')}</Button></Col>
</Row>
</Col>
</Row>
<div className="language-selector">
<LanguageSelector/>
</div>

{/* Debug info box */}
<div className="debug-info">
Branch: <strong>{gitBranch}</strong> | Build: <strong>{buildDate}</strong>
{t('branch')}: <strong>{gitBranch}</strong> | {t('build')}: <strong>{buildDate}</strong>
</div>
</div>
)
}

export default WelcomePage
export default WelcomePage
22 changes: 22 additions & 0 deletions src/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import i18n from 'i18next'
import { initReactI18next } from 'react-i18next'
import enTranslations from './locales/en.json'
import itTranslations from './locales/it.json'
import nlTranslations from './locales/nl.json'

i18n
.use(initReactI18next)
.init({
resources: {
en: { translation: enTranslations },
it: { translation: itTranslations },
nl: { translation: nlTranslations }
},
lng: 'en',
fallbackLng: 'en',
interpolation: {
escapeValue: false
}
})

export default i18n
11 changes: 11 additions & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"welcomeToAlbatross": "Welcome to Albatross",
"applicationLogoAlt": "Application logo - albatross flying",
"openOrCreateDocument": "Open an existing document or create a new one",
"new": "New",
"samplePlot": "Sample plot",
"open": "Open",
"branch": "Branch",
"build": "Build",
"unknown": "unknown"
}
11 changes: 11 additions & 0 deletions src/locales/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"welcomeToAlbatross": "Benvenuto in Albatross",
"applicationLogoAlt": "Logo dell'applicazione - albatross in volo",
"openOrCreateDocument": "Apri un documento esistente o creane uno nuovo",
"new": "Nuovo",
"samplePlot": "Grafico di esempio",
"open": "Apri",
"branch": "Ramo",
"build": "Compilazione",
"unknown": "sconosciuto"
}
11 changes: 11 additions & 0 deletions src/locales/nl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"welcomeToAlbatross": "Welkom bij Albatross",
"applicationLogoAlt": "Applicatielogo - vliegende albatros",
"openOrCreateDocument": "Open een bestaand document of maak een nieuw document",
"new": "Nieuw",
"samplePlot": "Voorbeeldgrafiek",
"open": "Openen",
"branch": "Tak",
"build": "Build",
"unknown": "onbekend"
}
34 changes: 34 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,13 @@
dependencies:
regenerator-runtime "^0.14.0"

"@babel/runtime@^7.25.0", "@babel/runtime@^7.26.10":
version "7.27.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.27.0.tgz#fbee7cf97c709518ecc1f590984481d5460d4762"
integrity sha512-VtPOkrdPHZsKc/clNqyi9WUA8TINkZ4cGk63UUE3u4pmB2k+ZMQRDuIOagv8UVd6j7k0T3+RRIb7beKTebNbcw==
dependencies:
regenerator-runtime "^0.14.0"

"@babel/template@^7.25.9", "@babel/template@^7.3.3":
version "7.25.9"
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.25.9.tgz#ecb62d81a8a6f5dc5fe8abfc3901fc52ddf15016"
Expand Down Expand Up @@ -7346,6 +7353,13 @@ html-escaper@^2.0.0:
resolved "https://registry.yarnpkg.com/html-escaper/-/html-escaper-2.0.2.tgz#dfd60027da36a36dfcbe236262c00a5822681453"
integrity sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==

html-parse-stringify@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/html-parse-stringify/-/html-parse-stringify-3.0.1.tgz#dfc1017347ce9f77c8141a507f233040c59c55d2"
integrity sha512-KknJ50kTInJ7qIScF3jeaFRpMpE8/lfiTdzf/twXyPBLAGrLRTmkz3AdTnKeh40X8k9L2fdYwEp/42WGXIRGcg==
dependencies:
void-elements "3.1.0"

http-cache-semantics@^4.0.0, http-cache-semantics@^4.1.0:
version "4.1.1"
resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz#abe02fcb2985460bf0323be664436ec3476a6d5a"
Expand Down Expand Up @@ -7409,6 +7423,13 @@ husky@^9.1.7:
resolved "https://registry.yarnpkg.com/husky/-/husky-9.1.7.tgz#d46a38035d101b46a70456a850ff4201344c0b2d"
integrity sha512-5gs5ytaNjBrh5Ow3zrvdUUY+0VxIuWVL4i9irt6friV+BqdCfmV11CQTWMiBYWHbXhco+J1kHfTOUkePhCDvMA==

i18next@^24.2.3:
version "24.2.3"
resolved "https://registry.yarnpkg.com/i18next/-/i18next-24.2.3.tgz#3a05f72615cbd7c00d7e348667e2aabef1df753b"
integrity sha512-lfbf80OzkocvX7nmZtu7nSTNbrTYR52sLWxPtlXX1zAhVw8WEnFk4puUkCR4B1dNQwbSpEHHHemcZu//7EcB7A==
dependencies:
"@babel/runtime" "^7.26.10"

iconv-lite@0.4.24:
version "0.4.24"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b"
Expand Down Expand Up @@ -10054,6 +10075,14 @@ react-fast-compare@^3.2.0:
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.2.2.tgz#929a97a532304ce9fee4bcae44234f1ce2c21d49"
integrity sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==

react-i18next@^15.4.1:
version "15.4.1"
resolved "https://registry.yarnpkg.com/react-i18next/-/react-i18next-15.4.1.tgz#33f3e89c2f6c68e2bfcbf9aa59986ad42fe78758"
integrity sha512-ahGab+IaSgZmNPYXdV1n+OYky95TGpFwnKRflX/16dY04DsYYKHtVLjeny7sBSCREEcoMbAgSkFiGLF5g5Oofw==
dependencies:
"@babel/runtime" "^7.25.0"
html-parse-stringify "^3.0.1"

react-icons@^4.2.0:
version "4.12.0"
resolved "https://registry.yarnpkg.com/react-icons/-/react-icons-4.12.0.tgz#54806159a966961bfd5cdb26e492f4dafd6a8d78"
Expand Down Expand Up @@ -11946,6 +11975,11 @@ vite@^5.4.10:
optionalDependencies:
fsevents "~2.3.3"

void-elements@3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09"
integrity sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==

walker@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/walker/-/walker-1.0.8.tgz#bd498db477afe573dc04185f011d3ab8a8d7653f"
Expand Down
Loading