-
-
Notifications
You must be signed in to change notification settings - Fork 67
Support for language translations and date formats #208
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
base: import-splitwise
Are you sure you want to change the base?
Conversation
* add edit expense * add edit expense changes * fix build * fix edit not working on exact match * set share to zero * fix deleting user on edit not working * fix auto load to expense page * make split share nice
* Add authentik provider * Add authentik provider * Add authentik provider * Add authentik provider
* Add nextauth_internal_url * Add NEXTAUTH_URL_INTERNAL option --------- Co-authored-by: KM Koushik <koushikmohan1996@gmail.com>
* feat: add invite-only flag * feat: wrap adapter to enforce invite-only mode
this updates the invite email sending function to prevent sending an invite email if the environment flag is not set. this matches the behavior with the frontend and prevents malicious actors from bypassing the logic fixes oss-apps#174
Gestione della lingua nella pagina "Account" e traduzione della pagina "Account"
|
||
// Funzione per ottenere il nome della lingua dal file di traduzione | ||
const getLanguageName = (languageCode: string): string => { | ||
return t(`ui/change_language_details/languages/${languageCode}`) || languageCode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not that familiar with i18next, but did you look into a type safe implementation?
https://www.i18next.com/overview/typescript
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I have not tried a type-safe implementation, if you could do it that would be better, I have never experimented with it and I would not know how to move
@Rosso2004 The PR is awesome and I would love to have it in Split Pro, but I would wait until there are more collaborators added to the project that would actually allow us to merge this. And I could take a swing at making this type safe once that happens |
|
||
// Restores the language selected when opening the drawer | ||
const handleClose = () => { | ||
setSelectedLanguage(initialLanguage); // Ripristina la lingua iniziale |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are still italian comments left :/
// Update the initial language when the drawer is opened | ||
useEffect(() => { | ||
if (languageOpen) { | ||
setInitialLanguage(i18n.language); // Set the initial language |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that comments like setInitialLanguage
is for setting the initial language is a bit overkill. Some of the comments are unnecessay and the code is self explaining enough without the need for extra clutter
<SplitEqualSection t={t} /> | ||
</TabsContent> | ||
<TabsContent value={SplitType.PERCENTAGE}> | ||
<SplitByPercentageSection /> | ||
<SplitByPercentageSection t={t} /> | ||
</TabsContent> | ||
<TabsContent value={SplitType.EXACT}> | ||
<SplitByAmountSection /> | ||
<SplitByAmountSection t={t}/> | ||
</TabsContent> | ||
<TabsContent value={SplitType.SHARE}> | ||
<SplitByShareSection /> | ||
<SplitByShareSection t={t} /> | ||
</TabsContent> | ||
<TabsContent value={SplitType.ADJUSTMENT}> | ||
<SplitByAdjustmentSection /> | ||
<SplitByAdjustmentSection t={t} /> | ||
</TabsContent> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the value need to be passed as a prop? Shouldn't the components be able to get the translation object themselves?
import {useTranslation} from "react-i18next"; | ||
import {type TFunction} from "i18next"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please run Prettier to maintain consistent formatting. The imports should look like the ones above with spaces near curly brackets
@@ -35,7 +37,8 @@ export const UploadFile: React.FC = () => { | |||
if (!file) return; | |||
|
|||
if (file.size > FILE_SIZE_LIMIT) { | |||
toast.error(`File should be less than ${FILE_SIZE_LIMIT / 1024 / 1024}MB`); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this newline
)} | ||
</div> | ||
<p className="text-xs text-gray-500"> | ||
{format(e.expense.expenseDate, 'dd MMM')} | ||
{format(e.expense.expenseDate, process.env.NEXT_PUBLIC_DATE_FORMAT_VARIANT_3 ?? 'dd MMM')} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use env
object
@@ -147,7 +151,8 @@ const FriendBalance: React.FC<{ | |||
currency: string; | |||
id: number; | |||
hasMore?: boolean; | |||
}> = ({ friend, amount, isPositive, currency, id, hasMore }) => { | |||
t: TFunction<string, undefined> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any use of this prop drilling? You can just call the hook again here
@@ -12,18 +12,20 @@ import { GroupAvatar } from '~/components/ui/avatar'; | |||
import { toUIString } from '~/utils/numbers'; | |||
import { motion } from 'framer-motion'; | |||
import { type NextPageWithUser } from '~/types'; | |||
import {useTranslation} from "react-i18next"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting
@@ -69,4 +75,4 @@ FEEDBACK_EMAIL= | |||
|
|||
# Discord webhook for error notifications | |||
DISCORD_WEBHOOK_URL= | |||
#********* END OF OPTIONAL ENV VARS ********* | |||
#********* END OF OPTIONAL ENV VARS ********* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
@@ -30,4 +30,4 @@ services: | |||
|
|||
volumes: | |||
database: | |||
minio: | |||
minio: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
newline
@Rosso2004 I have been added as a Collaborator so we can proceed with the review and merging the changes :) |
Thank you so much |
Description
This PR adds multilingual support using i18n. Now, new languages can be added simply by creating a new folder inside /public/locales, named with the language code (e.g., en, es, de, it, etc.).
For example, to add German, just duplicate the en folder (or any other existing language folder) and translate the JSON files inside it. No code modifications are required to enable a new language.
Main Changes
Added i18n support with JSON-based language management.
Translation structure located in /public/locales/{lang_code}/.
New Environment Variables (.env)
Preview

