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

Add i18n module + translations #50

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
"@types/react-dom": "^18.0.11",
"buffer": "^5.7.1",
"parcel": "^2.8.3",
"path-browserify": "^1.0.1",
"parcel-reporter-static-files-copy": "^1.5.0",
"path-browserify": "^1.0.1",
"process": "^0.11.10"
},
"dependencies": {
Expand All @@ -32,22 +32,25 @@
"@tabler/icons-react": "^2.9.0",
"@tanstack/react-location": "^3.7.4",
"@types/node": "18.15.0",
"@types/react": "18.0.28",
"@types/react-dom": "18.0.11",
"@types/react": "^18.0.28",
"@types/react-dom": "^18.0.11",
"dexie": "^3.2.3",
"dexie-export-import": "^4.0.6",
"dexie-react-hooks": "^1.1.3",
"downloadjs": "^1.4.7",
"eslint": "8.36.0",
"eslint-config-next": "13.2.4",
"gpt-token-utils": "^1.2.0",
"i18next": "^22.4.15",
"i18next-browser-languagedetector": "^7.0.1",
"lodash": "^4.17.21",
"nanoid": "^4.0.1",
"next": "13.2.4",
"openai": "^3.2.1",
"openai-ext": "^1.2.6",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^12.2.2",
"react-icons": "^4.8.0",
"react-markdown": "^8.0.6",
"remark-gfm": "^3.0.1",
Expand Down
157 changes: 157 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"translation": {
"notAnotherUI": "Not just another ChatGPT user-interface!",
"changeOpenAIKey": "Change OpenAI Key",
"enterOpenAIKey": "Enter OpenAI Key",
"downloadDesktopApp": "Download Desktop App",
"freeAndOpenSource": {
"title": "Free and open source",
"description": "This app is provided for free and the source code is available on GitHub."
},
"privacyFocused": {
"title": "Privacy focused",
"description": "No tracking, no cookies, no bullshit. All your data is stored locally."
},
"bestExperience": {
"title": "Best experience",
"description": "Crafted with love and care to provide the best experience possible."
},
"search": "Search",
"lightMode": "Light Mode",
"darkMode": "Dark Mode",
"settings": "Settings",
"database": "Database",
"sourceCode": "Source Code",
"followOnTwitter": "Follow on Twitter",
"giveFeedback": "Give Feedback",
"chats": "Chats",
"newChat": "New Chat",
"prompts": "Prompts",
"newPrompt": "New Prompt",
"savePrompt": "Save Prompt",
"createPrompt": "Create Prompt",
"savedPrompt": {
"title": "Saved",
"message": "Prompt created"
},
"error": {
"title": "Error"
},
"networkError": {
"title": "Error",
"message": "No internet connection."
},
"chatIdError": {
"title": "Error",
"message": "chatId is not defined. Please create a chat to get started."
},
"apiKeyError": {
"title": "Error",
"message": "OpenAI API Key is not defined. Please set your API Key"
},
"title": "Title",
"content": "Content",
"save": "save",
"youAre": "You are",
"respondInTone": "Respond in",
"respondInStyle": "Respond in",
"tone": "tone",
"style": "style",
"youAreChatGPT": "You are ChatGPT, a large language model trained by OpenAI.",
"defineTitleChat": "What would be a short and relevant title for this chat ? You must strictly answer with only the title, no other text is allowed.",
"character": "Character",
"toneList": "Tone",
"styleList": "Style",
"format": "Format",
"yourMessageHere": "Your message here...",
"deleteChats": "Delete Chats",
"confirmDeleteChats": "Are you sure you want to delete your chats?",
"deleteChat": "Delete Chat",
"confirmDeleteChat": "Are you sure you want to delete this chat?",
"delete": "Delete",
"deleted": "Deleted",
"chatDeleted": "Chat deleted.",
"removeChatError": {
"title": "Error",
"message": "Can't remove chat. Please refresh the page and try again."
},
"openAIAPIKey": "OpenAI API Key",
"getYourOpenAIAPIkey": "Get your OpenAI API key",
"APIKeyStoredLocally": "The API Key is stored locally on your browser and never sent anywhere else.",
"openAIType": "OpenAI Type",
"openAIKeySaved": {
"title": "saved",
"message": "Your OpenAI Key has been saved."
},
"openAITypeSaved": {
"title": "saved",
"message": "Your OpenAI Type has been saved."
},
"openIATTypeCustom": "Custom (e.g. Azure OpenAI)",
"openAIModel": "OpenAI Model (OpenAI Only)",
"openAIModelSaved": {
"title": "saved",
"message": "Your OpenAI Model has been saved."
},
"warning": "Warning",
"warningCostMessage": "The displayed cost was not updated yet to reflect the costs for each model. Right now it will always show the cost for GPT-3.5 on OpenAI.",
"openAIAuth": "OpenAI Auth (Custom Only)",
"openAIAuthSaved": {
"title": "saved",
"message": "Your OpenAI Auth has been saved."
},
"none": "None",
"bearerToken": "Bearer Token",
"apiKey": "API Key",
"openAIBaseSaved": {
"title": "saved",
"message": "Your OpenAI Base has been saved."
},
"openAIAPIBase": "OpenAI API Base (Custom Only)",
"openAIAPIVersion": "OpenAI API Version (Custom Only)",
"openAIVersionSaved": {
"title": "saved",
"message": "Your OpenAI Version has been saved."
},
"newChatFromPrompt": "New Chat From Prompt",
"copied": "Copied",
"copy": "Copy",
"words": "words",
"editPrompt": "Edit Prompt",
"promptUpdated": {
"title": "saved",
"message": "Prompt updated"
},
"editChat": "Edit Chat",
"chatUpdated": {
"title": "saved",
"message": "Chat updated"
},
"name": "Name",
"deleteAllData": "Delete All Data",
"confirmDeleteAllData": "Are you sure you want to delete your data?",
"messages": "Messages",
"exportingData" : {
"title": "Exporting Data",
"message": "Your data is being exported."
},
"exportData": "Export Data",
"importingData" : {
"title": "Import Data",
"message": "Your data is being imported."
},
"importData": "Import Data",
"selectedFileError": {
"title": "Error",
"message": "The file you selected is invalid"
},
"edit": "Edit",
"promptDeleted": "Prompt deleted.",
"removePromptError": {
"title": "Error",
"message": "Can't remove prompt. Please refresh the page and try again."
},
"deletePrompt": "Delete Prompt",
"confirmDeletePrompt": "Are you sure you want to delete this prompt?"
}
}
157 changes: 157 additions & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
{
"translation": {
"notAnotherUI": "Ce n'est pas juste une autre interface de ChatGPT !",
"changeOpenAIKey": "Modifier la clé API d'OpenAI",
"enterOpenAIKey": "Entrer la clé API d'OpenAI",
"downloadDesktopApp": "Télécharger l'application de bureau",
"freeAndOpenSource": {
"title": "Gratuit et open source",
"description": "Cette application est gratuite et le code source est disponible sur GitHub."
},
"privacyFocused": {
"title": "Centré sur la vie privée",
"description": "Pas de suivi, pas de cookies, pas de mensonge. Toutes vos données sont stockées localement."
},
"bestExperience": {
"title": "La meilleure expérience",
"description": "Fabriqué avec amour et soin pour offrir la meilleure expérience possible."
},
"search": "Rechercher",
"lightMode": "Mode clair",
"darkMode": "Mode sombre",
"settings": "Paramètres",
"database": "Base de données",
"sourceCode": "Code source",
"followOnTwitter": "Suivez-nous sur Twitter",
"giveFeedback": "Donnez votre avis",
"chats": "Conversations",
"newChat": "Nouvelle conversation",
"prompts": "Prompts",
"newPrompt": "Nouveau Prompt",
"savePrompt": "Enregistrer le Prompt",
"createPrompt": "Créer un Prompt",
"savedPrompt": {
"title": "Sauvegardé",
"message": "Prompt créée"
},
"error": {
"title": "Erreur"
},
"networkError": {
"title": "Erreur",
"message": "Pas de connexion internet."
},
"chatIdError": {
"title": "Erreur",
"message": "le ChatId n'est pas défini. Veuillez créer une conversation pour commencer."
},
"apiKeyError": {
"title": "Erreur",
"message": "La clé API OpenAI n'est pas définie. Veuillez définir votre clé API"
},
"title": "Titre",
"content": "Contenu",
"save": "Enregistrer",
"youAre": "Tu es",
"respondInTone": "Réponds sur un ton",
"respondInStyle": "Réponds dans un style",
"tone": "",
"style": "",
"youAreChatGPT": "Tu es ChatGPT, un modèle de langage avancé entraîné par OpenAI.",
"defineTitleChat": "Titre court et pertinent pour cette discussion ? Vous devez répondre strictement avec le titre, aucun autre texte n'est autorisé.",
"character": "Personnage",
"toneList": "Ton",
"styleList": "Style",
"format": "Format",
"yourMessageHere": "Votre message ici...",
"deleteChats": "Supprimer les conversations",
"confirmDeleteChats": "Êtes-vous sûr de vouloir supprimer les conversations ?",
"deleteChat": "Supprimer la conversation",
"confirmDeleteChat": "Êtes-vous sûr de vouloir supprimer la conversation ?",
"delete": "Supprimer",
"deleted": "Supprimée",
"chatDeleted": "Conversation supprimée.",
"removeChatError": {
"title": "Erreur",
"message": "Impossible de supprimer la conversation. Veuillez actualiser la page et réessayer."
},
"openAIAPIKey": "Clé API OpenAI",
"getYourOpenAIAPIkey": "Obtenez votre clé API OpenAI",
"APIKeyStoredLocally": "La clé API est stockée localement sur votre navigateur et n'est jamais envoyée ailleurs.",
"openAIType": "Type d'OpenAI",
"openAIKeySaved": {
"title": "Sauvegardé",
"message": "Votre clé OpenAI a été enregistrée."
},
"openAITypeSaved": {
"title": "Sauvegardé",
"message": "Votre type d'OpenAI a été enregistré."
},
"openIATTypeCustom": "Personnalisé (par exemple: Azure OpenAI)",
"openAIModel": "Modèle OpenAI (OpenAI seulement)",
"openAIModelSaved": {
"title": "Sauvegardé",
"message": "Votre modèle OpenAI a été enregistré."
},
"warning": "Avertissement",
"warningCostMessage": "Le coût affiché n'a pas encore été mis à jour pour refléter les coûts de chaque modèle. Pour l'instant, le coût affiché est toujours celui du modèle GPT-3.5 de l'OpenAI.",
"openAIAuth": "Methode d'authentification OpenAI (personnalisé seulement)",
"openAIAuthSaved": {
"title": "Sauvegardé",
"message": "Votre methode d'authentification OpenAI a été enregistré."
},
"none": "Aucune",
"bearerToken": "Bearer Token",
"apiKey": "Clé API",
"openAIBaseSaved": {
"title": "Sauvegardé",
"message": "Votre URL d'API OpenAI a été enregistrée."
},
"openAIAPIBase": "URL d'API OpenAI (personnalisé uniquement)",
"openAIAPIVersion": "Version de l'API OpenAI (personnalisé uniquement)",
"openAIVersionSaved": {
"title": "Sauvegardé",
"message": "Votre version OpenAI a été enregistrée."
},
"newChatFromPrompt": "Nouvelle conversattion à partir du prompt",
"copied": "Copié !",
"copy": "Copier",
"words": "mots",
"editPrompt": "Modifier le prompt",
"promptUpdated": {
"title": "Sauvegardé",
"message": "Prompt enregistré"
},
"editChat": "Modifier la conversation",
"chatUpdated": {
"title": "Sauvegardé",
"message": "Conversation enregistrée"
},
"name": "Nom",
"deleteAllData": "Supprimer toutes les données",
"confirmDeleteAllData": "Êtes-vous sûr de vouloir effacer toutes vos données ?",
"messages": "Messages",
"exportingData" : {
"title": "Exportation de données",
"message": "Vos données sont en cours d'exportation."
},
"exportData": "Exporter les données",
"importingData" : {
"title": "Importation de données",
"message": "Vos données sont en cours d'importation."
},
"importData": "Importer les données",
"selectedFileError": {
"title": "Erreur",
"message": "Le fichier sélectionné n'est pas valide"
},
"edit": "Modifier",
"promptDeleted": "Prompt supprimée.",
"removePromptError": {
"title": "Erreur",
"message": "Impossible de supprimer le prompt. Veuillez rafraîchir la page et réessayer."
},
"deletePrompt": "Supprimer le prompt",
"confirmDeletePrompt": "Êtes-vous sûr de vouloir supprimer ce prompt ?"
}
}
2 changes: 1 addition & 1 deletion src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import { ChatRoute } from "../routes/ChatRoute";
import { IndexRoute } from "../routes/IndexRoute";
import { Layout } from "./Layout";
import '../i18n';

const history = createHashHistory();
const location = new ReactLocation({ history });
Expand All @@ -30,7 +31,6 @@ export function App() {
setColorScheme(value || (colorScheme === "dark" ? "light" : "dark"));

useHotkeys([["mod+J", () => toggleColorScheme()]]);

return (
<Router
location={location}
Expand Down
5 changes: 3 additions & 2 deletions src/components/Chats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { useChatId } from "../hooks/useChatId";
import { DeleteChatModal } from "./DeleteChatModal";
import { EditChatModal } from "./EditChatModal";
import { MainLink } from "./MainLink";
import {t} from "i18next";

export function Chats({ search }: { search: string }) {
const chatId = useChatId();
Expand Down Expand Up @@ -55,10 +56,10 @@ export function Chats({ search }: { search: string }) {
</Menu.Target>
<Menu.Dropdown>
<EditChatModal chat={chat}>
<Menu.Item>Edit</Menu.Item>
<Menu.Item>{t('edit')}</Menu.Item>
</EditChatModal>
<DeleteChatModal chat={chat}>
<Menu.Item>Delete</Menu.Item>
<Menu.Item>{t('delete')}</Menu.Item>
</DeleteChatModal>
</Menu.Dropdown>
</Menu>
Expand Down
Loading