Skip to content

Commit 4ef468c

Browse files
davisaglistevepiercypnicolli
authored
Get language settings from backend (#7125)
Co-authored-by: Steve Piercy <[email protected]> Co-authored-by: Piero Nicolli <[email protected]>
1 parent ee56c9b commit 4ef468c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+585
-265
lines changed

docs/source/configuration/environmentvariables.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,17 @@ You can also generate builds on your continuous integration, then deploy them an
186186
```
187187
188188
`SITE_DEFAULT_LANGUAGE`
189-
This is a runtime environment variable that sets the `config.settings.defaultLanguage`, allowing you to specify the default language of a site. It needs to match the default language that is configured in the backend's Language control panel.
189+
```{versionremoved} Volto 19
190+
This environment variable was removed in Volto 19.
191+
Instead, Volto uses the default language configured in the backend.
192+
```
193+
194+
```{seealso}
195+
See {ref}`multilingual configuration in Volto <multilingual-volto-configuration-label>`.
196+
```
197+
198+
This is a runtime environment variable that sets the `config.settings.defaultLanguage`, allowing you to specify the default language of a site.
199+
It needs to match the default language that is configured in the backend's {guilabel}`Language` control panel in {guilabel}`Site Setup`.
190200
191201
```shell
192202
SITE_DEFAULT_LANGUAGE=ca pnpm start

docs/source/configuration/how-to.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@ You must provide a function as default export in your `src/config.js`:
4646
export default function applyConfig(config) {
4747
config.settings = {
4848
...config.settings,
49-
isMultilingual: true,
50-
supportedLanguages: ['en', 'de'],
51-
defaultLanguage: 'de',
5249
navDepth: 3,
5350
};
5451

docs/source/configuration/multilingual.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,30 @@ It is included with Plone 5 and later.
1414
You can enable it through the {guilabel}`Add-ons` control panel in the administrative interface.
1515

1616

17+
18+
(multilingual-volto-configuration-label)=
19+
1720
## Volto configuration
1821

19-
You need to enable multilingual in Volto's configuration object.
22+
Multilingual configuration in Volto depends on its version.
23+
24+
### Volto 19 and later
25+
26+
In Volto 19 and later, both the default language and available languages are defined in the Plone site configuration.
27+
A site administrator can configure these values in the {guilabel}`Languages` control panel in {guilabel}`Site Setup`.
28+
A developer can configure them using GenericSetup.
29+
30+
```{versionchanged} Volto 19
31+
Use multilingual configuration from the backend, instead of Volto config settings for the frontend.
32+
```
33+
34+
### Volto 18 and earlier
35+
36+
```{versionremoved} Volto 19
37+
The environment variable `SITE_DEFAULT_LANGUAGE` was removed in Volto 19.
38+
```
39+
40+
In Volto 18 and earlier, enable the multilingual feature in Volto's configuration settings.
2041

2142
```js
2243
import config from '@plone/volto/registry'

docs/source/configuration/settings-reference.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,13 +487,37 @@ showRelatedItems
487487
```{versionadded} 18.5.0
488488
```
489489
490-
491490
showTags
492491
If true, the `Tags` component will show tags from the `subjects` field. Default: true.
493492
493+
isMultilingual
494+
If `true`, features for translating content to multiple languages are available.
495+
Default: `false`.
496+
497+
````{versionremoved} Volto 19
498+
This setting was removed in Volto 19.
499+
Instead, Volto checks whether the backend has multilingual features enabled.
500+
501+
```{seealso}
502+
See {ref}`multilingual configuration in Volto <multilingual-volto-configuration-label>`.
503+
```
504+
````
494505
495506
defaultLanguage
496-
Defines the default language of the site.
507+
Sets the default language of the site.
508+
509+
````{versionremoved} Volto 19
510+
This setting was removed in Volto 19.
511+
Instead, the default language is loaded from the backend.
512+
513+
```{seealso}
514+
See {ref}`multilingual configuration in Volto <multilingual-volto-configuration-label>`.
515+
```
516+
````
517+
518+
supportedLanguages
519+
A list of locales which are included in the bundled code.
520+
497521
```
498522

499523
## Views settings

docs/source/contributing/acceptance-tests.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,6 @@ You can modify the main Volto settings on the fly.
147147
148148
```js
149149
cy.settings().then(settings => {
150-
settings.defaultLanguage = 'de';
151-
settings.isMultilingual = true;
152150
settings.supportedLanguages = ['de', 'en'];
153151
});
154152
```

docs/source/upgrade-guide/index.md

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ These packages have been removed from the Volto repository as they are no longer
6464
- `@plone/volto-guillotina`: No longer actively maintained
6565
- `@plone/volto-testing`: Testing functionality is now integrated directly in Volto core
6666

67+
### Removed language settings
68+
```{versionremoved} Volto 19
69+
```
70+
71+
The `defaultLanguage` and `isMultilingual` settings have been removed.
72+
Instead, these values are fetched from the backend API.
73+
The `supportedLanguages` setting now only controls which locales are included in the build.
6774

6875
(upgrading-to-volto-18-x-x)=
6976

@@ -2101,7 +2108,6 @@ import config from '@plone/volto/registry'
21012108
...
21022109
21032110
console.log(config.settings.apiPath)
2104-
config.settings.isMultilingual = true
21052111
...
21062112
```
21072113
@@ -2218,9 +2224,6 @@ Let's show it in an example. Let's say you have this config in your project's `s
22182224
```js
22192225
export const settings = {
22202226
...defaultSettings,
2221-
isMultilingual: true,
2222-
supportedLanguages: ['en', 'de'],
2223-
defaultLanguage: 'de',
22242227
navDepth: 3,
22252228
};
22262229
```
@@ -2231,9 +2234,6 @@ then you'll add the `applyConfig()` function as default export and copy that set
22312234
export default function applyConfig(config) {
22322235
config.settings = {
22332236
...config.settings,
2234-
isMultilingual: true,
2235-
supportedLanguages: ['en', 'de'],
2236-
defaultLanguage: 'de',
22372237
navDepth: 3,
22382238
};
22392239
return config;
@@ -2325,9 +2325,6 @@ showing in the diff the default ones, you should have your configuration inside
23252325
```js
23262326
export const settings = {
23272327
...defaultSettings,
2328-
isMultilingual: true,
2329-
supportedLanguages: ['en', 'de'],
2330-
defaultLanguage: 'de',
23312328
navDepth: 3,
23322329
};
23332330
```
@@ -2363,9 +2360,6 @@ the end of `src/config.js`:
23632360
+function applyConfig(config) {
23642361
+ config.settings = {
23652362
+ ...config.settings,
2366-
+ isMultilingual: true,
2367-
+ supportedLanguages: ['en', 'de'],
2368-
+ defaultLanguage: 'de',
23692363
+ navDepth: 3,
23702364
+ };
23712365
```

packages/coresandbox/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ const listing = (config: ConfigType) => {
174174
};
175175

176176
export const multilingualFixture = (config: ConfigType) => {
177-
config.settings.isMultilingual = true;
178177
config.settings.supportedLanguages = ['en', 'it'];
179178

180179
return config;

packages/types/news/7125.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Removed the `isMultilingual` and `defaultLanguage` settings. @davisagli

packages/types/src/config/Settings.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ export interface SettingsConfig {
5252
openExternalLinkInNewTab: boolean;
5353
notSupportedBrowsers: string[];
5454
defaultPageSize: number;
55-
isMultilingual: boolean;
5655
supportedLanguages: string[]; // TODO: Improve list of possible values
57-
defaultLanguage: string;
5856
navDepth: number;
5957
expressMiddleware: unknown;
6058
defaultBlockType: string; // TODO: Improve list of possible values
2.62 MB
Binary file not shown.

0 commit comments

Comments
 (0)