Skip to content

Commit f20f8cf

Browse files
authored
Merge pull request #10 from PxTools/update-documentation-locale-content
Startet on documentation locale content
2 parents 791daca + b99b5ee commit f20f8cf

File tree

1 file changed

+79
-21
lines changed

1 file changed

+79
-21
lines changed

docs/PxWeb2/documentation/customization.md

Lines changed: 79 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,28 @@ public
2424
│ └── translation.json
2525
└── theme
2626
│ └── variables.css
27-
└── icon
28-
├── topicIconMap.json
29-
├── topicIcons.json
30-
└── topic
31-
├── icon1.svg
32-
├── icon2.svg
33-
├── ...
34-
└── small/
35-
├── icon1.svg
36-
├── icon2.svg
37-
└── ...
27+
├── icon
28+
│ ├── topicIconMap.json
29+
│ ├── topicIcons.json
30+
│ └── topic
31+
│ ├── icon1.svg
32+
│ ├── icon2.svg
33+
│ ├── ...
34+
│ └── small/
35+
│ ├── icon1.svg
36+
│ ├── icon2.svg
37+
│ └── ...
38+
├── content
39+
│ ├── en
40+
│ │ └── content.json
41+
│ └── sv
42+
│ │ └── content.json
43+
│ └── ...
3844
```
3945

4046
### config.js
4147

42-
``` javascript
48+
```javascript
4349
window.PxWeb2Config = {
4450
language: {
4551
supportedLanguages: [
@@ -49,15 +55,67 @@ window.PxWeb2Config = {
4955
defaultLanguage: "en",
5056
fallbackLanguage: "en",
5157
},
52-
apiUrl: "..."
58+
apiUrl: "...",
5359
};
5460
```
5561

62+
### content.json
63+
64+
The `content.json` file defines customizable text and links that appear in **PxWeb’s user interface**
65+
This file allows you to configure localized UI content: you can add or change the **breadcrumb navigation** on the start page, add a **detailsSection** after the ingress on the start page, or update the **footer** content for the application.
66+
67+
```sh
68+
public/content
69+
├── ar
70+
│ └── content.json
71+
├── en
72+
│ └── content.json
73+
├── no
74+
│ └── content.json
75+
└── sv
76+
└── content.json
77+
```
78+
79+
- Each language folder contains its own `content.json`.
80+
- The active language determines which file is loaded at runtime.
81+
- This makes it possible to have different breadcrumbs, footer links, or details text depending on the selected language.
82+
83+
**Structure overview:**
84+
85+
```json
86+
{
87+
"startPage": {
88+
"breadCrumb": {
89+
"enabled": false,
90+
"items": []
91+
},
92+
"detailsSection": {
93+
"enabled": true,
94+
"detailHeader": "More about PxWeb",
95+
"detailContent": []
96+
}
97+
},
98+
"footer": {
99+
"columns": []
100+
}
101+
}
102+
```
103+
104+
- **startPage.breadCrumb**
105+
Optional breadcrumb navigation on start page. Enabled with the `enabled` flag.
106+
Each item contains a `label` and an `href`.
107+
- **startPage.detailsSection** – Optional section below the page ingress. When `enabled` is `true`, the application renders the **`DetailsSection` component**. This section can contain multiple entries, and each entry may be either a `textBlock` (with `header` and `text`) or a `links` block (with `header` and a list of `items`).
108+
109+
- **footer**
110+
One or more footer columns with `header` and list of `links`.
111+
112+
This setup allows administrators to adjust localized content (text and links) for each language without modifying the application code.
113+
56114
### translation.json
57115

58116
Create a new folder and `translation.json` file using english as a template.
59117

60-
``` json
118+
```json
61119
{
62120
"meta": {
63121
"languageName": "English",
@@ -77,7 +135,7 @@ Create a new folder and `translation.json` file using english as a template.
77135

78136
The css file will let you adjust colors to match you site profile.
79137

80-
``` css
138+
```css
81139
:root {
82140
--px-border-radius-none: 0;
83141
--px-border-radius-xxsmall: 0.5px;
@@ -94,8 +152,8 @@ The css file will let you adjust colors to match you site profile.
94152

95153
### topicIconMap.json
96154

97-
The startpage displays a list of tables using the `TableCard` component. 
98-
To associate an icon with the main topic a table belongs to, there must be a mapping between the **topic ID** and the corresponding **SVG filename**. 
155+
The startpage displays a list of tables using the `TableCard` component. 
156+
To associate an icon with the main topic a table belongs to, there must be a mapping between the **topic ID** and the corresponding **SVG filename**. 
99157
This mapping is defined in `/public/icon/topic/topicIconMap.json`
100158

101159
If you want to add new icons, they must be placed in both of the following folders:
@@ -113,7 +171,7 @@ When adding new icons to public/icons/topic/, you must also update topicIcons.js
113171

114172
## PxWebApi
115173

116-
``` sh
174+
```sh
117175
PxWeb
118176
├── appsettings.Development.json
119177
├── appsettings.Release.json
@@ -128,7 +186,7 @@ configs. The [docker](docker.md) example runs i Development mode and use most
128186
values from `appsettings.json`. There are currently only two places you need to
129187
add more languages
130188

131-
``` json
189+
```json
132190
...
133191
"PxApiConfiguration": {
134192
"Languages": [
@@ -149,7 +207,7 @@ add more languages
149207

150208
Curently it is exactly as in PxWeb 2023
151209

152-
``` xml
210+
```xml
153211
<?xml version="1.0" encoding="iso-8859-1"?>
154212
<SqlDbConfig version="2008"
155213
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -160,7 +218,7 @@ Curently it is exactly as in PxWeb 2023
160218

161219
But you have to change `appsettings.json` to use CNMM like this
162220

163-
``` json
221+
```json
164222
{
165223
"DataSource": {
166224
"DataSourceType": "CNMM",

0 commit comments

Comments
 (0)