-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[WEB-2870]feat: language support #6215
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
Merged
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
607ca5a
fix: adding language support package
sriramveeraghanta 254db2d
Merge branch 'preview' of github.com:makeplane/plane into feat-langua…
sriramveeraghanta 2dab6c0
fix: language support implementation using mobx
sriramveeraghanta f311264
fix: adding more languages for support
sriramveeraghanta 194003d
fix: profile settings translations
sriramveeraghanta 07c5147
feat: added language support for sidebar and user settings
vamsikrishnamathala e1fede3
feat: added language support for deactivation modal
vamsikrishnamathala 28c5e3f
fix: added project sync after transfer issues (#6200)
vamsikrishnamathala 8800b2f
code refactor and improvement (#6203)
anmolsinghbhatia 23dc6f5
refactor: enhance workspace and project wrapper modularity (#6207)
prateekshourya29 4d13b0b
[WEB-2678]feat: added functionality to add labels directly from dropd…
vamsikrishnamathala c1fbe98
chore: added common component for project activity (#6212)
gakshita c17f43f
- Do not clear temp files that are locked. (#6214)
SatishGandham fa4af3c
fix: labels empty state for drop down (#6216)
vamsikrishnamathala 00f5a5c
refactor: remove cn helper function from the editor package (#6217)
aaryan610 7002474
Merge branch 'preview' of github.com:makeplane/plane into feat-langua…
vamsikrishnamathala ed5ff98
Merge branch 'preview' of github.com:makeplane/plane into feat-langua…
vamsikrishnamathala fdcc233
* feat: added language support to issue create modal in sidebar
vamsikrishnamathala fd5b829
* fix: added missing translations
vamsikrishnamathala 7c4d548
fix: fixed spanish translation
vamsikrishnamathala c1f6887
Merge branch 'preview' of gurusainath:makeplane/plane into feat-langu…
gurusainath 0ef2aee
dev: language type error in space user profile types
gurusainath 0ae0832
fix: type fixes
sriramveeraghanta 5bd199f
chore: added alpha tag
vamsikrishnamathala 988261c
Merge branch 'feat-language-support' of github.com:makeplane/plane in…
vamsikrishnamathala File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| export const ORGANIZATION_SIZE = [ | ||
| "Just myself", | ||
| "Just myself", // TODO: translate | ||
| "2-10", | ||
| "11-50", | ||
| "51-200", | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| build/* | ||
| dist/* | ||
| out/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| /** @type {import("eslint").Linter.Config} */ | ||
| module.exports = { | ||
| root: true, | ||
| extends: ["@plane/eslint-config/library.js"], | ||
| parser: "@typescript-eslint/parser", | ||
| parserOptions: { | ||
| project: true, | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .turbo | ||
| out/ | ||
| dist/ | ||
| build/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| { | ||
| "printWidth": 120, | ||
| "tabWidth": 2, | ||
| "trailingComma": "es5" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "name": "@plane/i18n", | ||
| "version": "0.24.1", | ||
| "description": "I18n shared across multiple apps internally", | ||
| "private": true, | ||
| "main": "./src/index.ts", | ||
| "types": "./src/index.ts", | ||
| "scripts": { | ||
| "lint": "eslint src --ext .ts,.tsx", | ||
| "lint:errors": "eslint src --ext .ts,.tsx --quiet" | ||
| }, | ||
| "dependencies": { | ||
| "@plane/utils": "*" | ||
| }, | ||
| "devDependencies": { | ||
| "@plane/eslint-config": "*", | ||
| "@types/node": "^22.5.4", | ||
| "typescript": "^5.3.3" | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { observer } from "mobx-react"; | ||
| import React, { createContext, useEffect } from "react"; | ||
| import { Language, languages } from "../config"; | ||
| import { TranslationStore } from "./store"; | ||
|
|
||
| // Create the store instance | ||
| const translationStore = new TranslationStore(); | ||
|
|
||
| // Create Context | ||
| export const TranslationContext = createContext<TranslationStore>(translationStore); | ||
|
|
||
| export const TranslationProvider = observer(({ children }: { children: React.ReactNode }) => { | ||
| // Handle storage events for cross-tab synchronization | ||
| useEffect(() => { | ||
| const handleStorageChange = (event: StorageEvent) => { | ||
| if (event.key === "userLanguage" && event.newValue) { | ||
| const newLang = event.newValue as Language; | ||
| if (languages.includes(newLang)) { | ||
| translationStore.setLanguage(newLang); | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| window.addEventListener("storage", handleStorageChange); | ||
| return () => window.removeEventListener("storage", handleStorageChange); | ||
| }, []); | ||
|
|
||
| return <TranslationContext.Provider value={translationStore}>{children}</TranslationContext.Provider>; | ||
| }); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import { makeObservable, observable } from "mobx"; | ||
| import { Language, fallbackLng, languages, translations } from "../config"; | ||
|
|
||
| export class TranslationStore { | ||
| currentLocale: Language = fallbackLng; | ||
|
|
||
| constructor() { | ||
| makeObservable(this, { | ||
| currentLocale: observable.ref, | ||
| }); | ||
| this.initializeLanguage(); | ||
| } | ||
|
|
||
| get availableLanguages() { | ||
| return languages; | ||
| } | ||
|
|
||
| t(key: string) { | ||
| return translations[this.currentLocale]?.[key] || translations[fallbackLng][key] || key; | ||
| } | ||
sriramveeraghanta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| setLanguage(lng: Language) { | ||
| try { | ||
| localStorage.setItem("userLanguage", lng); | ||
| this.currentLocale = lng; | ||
| } catch (error) { | ||
| console.error(error); | ||
| } | ||
| } | ||
|
|
||
| initializeLanguage() { | ||
| if (typeof window === "undefined") return; | ||
| const savedLocale = localStorage.getItem("userLanguage") as Language; | ||
| if (savedLocale && languages.includes(savedLocale)) { | ||
| this.setLanguage(savedLocale); | ||
| } else { | ||
| const browserLang = navigator.language.split("-")[0] as Language; | ||
| const newLocale = languages.includes(browserLang as Language) ? (browserLang as Language) : fallbackLng; | ||
| this.setLanguage(newLocale); | ||
| } | ||
| } | ||
sriramveeraghanta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import en from "../locales/en/translations.json"; | ||
| import fr from "../locales/fr/translations.json"; | ||
| import es from "../locales/es/translations.json"; | ||
| import ja from "../locales/ja/translations.json"; | ||
|
|
||
| export type Language = (typeof languages)[number]; | ||
| export type Translations = { | ||
| [key: string]: { | ||
| [key: string]: string; | ||
| }; | ||
| }; | ||
sriramveeraghanta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| export const fallbackLng = "en"; | ||
| export const languages = ["en", "fr", "es", "ja"] as const; | ||
| export const translations: Translations = { | ||
| en, | ||
| fr, | ||
| es, | ||
| ja, | ||
| }; | ||
|
|
||
| export const SUPPORTED_LANGUAGES = [ | ||
| { | ||
| label: "English", | ||
| value: "en", | ||
| }, | ||
| { | ||
| label: "French", | ||
| value: "fr", | ||
| }, | ||
| { | ||
| label: "Spanish", | ||
| value: "es", | ||
| }, | ||
| { | ||
| label: "Japanese", | ||
| value: "ja", | ||
| }, | ||
| ]; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export * from "./use-translation"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { useContext } from "react"; | ||
| import { TranslationContext } from "../components"; | ||
| import { Language } from "../config"; | ||
|
|
||
| export function useTranslation() { | ||
| const store = useContext(TranslationContext); | ||
| if (!store) { | ||
| throw new Error("useTranslation must be used within a TranslationProvider"); | ||
| } | ||
|
|
||
| return { | ||
| t: (key: string) => store.t(key), | ||
| currentLocale: store.currentLocale, | ||
| changeLanguage: (lng: Language) => store.setLanguage(lng), | ||
| languages: store.availableLanguages, | ||
| }; | ||
sriramveeraghanta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| export * from "./config"; | ||
| export * from "./components"; | ||
| export * from "./hooks"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.