-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Localized fields language switch (#708)
* Integrate language switch * Display language switch based on active tab * Remove editor settings * Ignore vs code settings * Reduce language selection to single selection * Automatic frontend build --------- Co-authored-by: vin0401 <[email protected]>
- Loading branch information
Showing
39 changed files
with
2,435 additions
and
47 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -21,6 +21,8 @@ Thumbs.db | |
# PhpStorm / IDEA | ||
.idea | ||
|
||
# VS Code | ||
.vscode | ||
|
||
# Test env | ||
/bin | ||
|
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
assets/js/src/core/assets/icons/split-cells-outlined.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
30 changes: 30 additions & 0 deletions
30
.../js/src/core/modules/data-object/editor/toolbar/language-selection/language-selection.tsx
This file contains 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,30 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import { LanguageSelection as BaseLanguageSelection } from '@Pimcore/components/language-selection/language-selection' | ||
import { useSettings } from '@Pimcore/modules/app/settings/hooks/use-settings' | ||
import React from 'react' | ||
import { useLanguageSelection } from './provider/use-language-selection' | ||
|
||
export const LanguageSelection = (): React.JSX.Element => { | ||
const settings = useSettings() | ||
const { currentLanguage, setCurrentLanguage } = useLanguageSelection() | ||
|
||
return ( | ||
<BaseLanguageSelection | ||
languages={ [...settings.requiredLanguages] } | ||
onSelectLanguage={ setCurrentLanguage } | ||
selectedLanguage={ currentLanguage } | ||
/> | ||
) | ||
} |
39 changes: 39 additions & 0 deletions
39
...es/data-object/editor/toolbar/language-selection/provider/language-selection-provider.tsx
This file contains 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 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import React, { createContext, useMemo, useState } from 'react' | ||
|
||
export interface ILanguageSelectionContext { | ||
currentLanguage: string | ||
setCurrentLanguage: (language: string) => void | ||
} | ||
|
||
export const LanguageSelectionContext = createContext<ILanguageSelectionContext>({ | ||
currentLanguage: 'en', | ||
setCurrentLanguage: () => {} | ||
}) | ||
|
||
export interface LanguageSelectionProviderProps { | ||
children: React.ReactNode | ||
} | ||
|
||
export const LanguageSelectionProvider = ({ children }: LanguageSelectionProviderProps): React.JSX.Element => { | ||
// @todo check for default language | ||
const [currentLanguage, setCurrentLanguage] = useState('en') | ||
|
||
return useMemo(() => ( | ||
<LanguageSelectionContext.Provider value={ { currentLanguage, setCurrentLanguage } }> | ||
{children} | ||
</LanguageSelectionContext.Provider> | ||
), [currentLanguage, children]) | ||
} |
25 changes: 25 additions & 0 deletions
25
...modules/data-object/editor/toolbar/language-selection/provider/use-language-selection.tsx
This file contains 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,25 @@ | ||
/** | ||
* Pimcore | ||
* | ||
* This source file is available under two different licenses: | ||
* - Pimcore Open Core License (POCL) | ||
* - Pimcore Commercial License (PCL) | ||
* Full copyright and license information is available in | ||
* LICENSE.md which is distributed with this source code. | ||
* | ||
* @copyright Copyright (c) Pimcore GmbH (http://www.pimcore.org) | ||
* @license https://github.com/pimcore/studio-ui-bundle/blob/1.x/LICENSE.md POCL and PCL | ||
*/ | ||
|
||
import { useContext } from 'react' | ||
import { type ILanguageSelectionContext, LanguageSelectionContext } from './language-selection-provider' | ||
|
||
export interface UseLanguageSelectionReturn extends ILanguageSelectionContext {} | ||
|
||
export const useLanguageSelection = (): UseLanguageSelectionReturn => { | ||
const context = useContext(LanguageSelectionContext) | ||
|
||
return { | ||
...context | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.