Skip to content

Commit 510e1e4

Browse files
Merge pull request #226 from PaperMold/feature/add-pt-pt-locale
Add pt-PT locale support
2 parents 33de3eb + ab9526e commit 510e1e4

File tree

6 files changed

+123
-41
lines changed

6 files changed

+123
-41
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ type File = {
116116
| `height` | string \| number | The height of the component `default: 600px`. Can be a string (e.g., `'100%'`, `'10rem'`) or a number (in pixels). |
117117
| `initialPath` | string | The path of the directory to be loaded initially e.g. `/Documents`. This should be the path of a folder which is included in `files` array. Default value is `""` |
118118
| `isLoading` | boolean | A boolean state indicating whether the application is currently performing an operation, such as creating, renaming, or deleting a file/folder. Displays a loading state if set `true`. |
119-
| `language` | string | A language code used for translations (e.g., `"en"`, `"fr"`, `"tr"`). Defaults to `"en"` for English. Allows the user to set the desired translation language manually. |
119+
| `language` | string | A language code used for translations (e.g., `"en-US"`, `"fr-FR"`, `"tr-TR"`). Defaults to `"en-US"` for English. Allows the user to set the desired translation language manually. <br><br>**Available languages:** <br> 🇸🇦 `ar-SA` (Arabic, Saudi Arabia) <br> 🇩🇪 `de-DE` (German, Germany) <br> 🇺🇸 `en-US` (English, United States) <br> 🇪🇸 `es-ES` (Spanish, Spain) <br> 🇫🇷 `fr-FR` (French, France) <br> 🇮🇱 `he-IL` (Hebrew, Israel) <br> 🇮🇳 `hi-IN` (Hindi, India) <br> 🇮🇹 `it-IT` (Italian, Italy) <br> 🇯🇵 `ja-JP` (Japanese, Japan) <br> 🇰🇷 `ko-KR` (Korean, South Korea) <br> 🇧🇷 `pt-BR` (Portuguese, Brazil) <br> 🇵🇹 `pt-PT` (Portuguese, Portugal) <br> 🇷🇺 `ru-RU` (Russian, Russia) <br> 🇹🇷 `tr-TR` (Turkish, Turkey) <br> 🇺🇦 `uk-UA` (Ukrainian, Ukraine) <br> 🇵🇰 `ur-UR` (Urdu, Pakistan) <br> 🇻🇳 `vi-VN` (Vietnamese, Vietnam) <br> 🇨🇳 `zh-CN` (Chinese, Simplified) <br> 🇵🇱 `pl-PL` (Polish, Poland) |
120120
| `layout` | "list" \| "grid" | Specifies the default layout style for the file manager. Can be either "list" or "grid". Default value is "grid". |
121121
| `maxFileSize` | number | For limiting the maximum upload file size in bytes. |
122122
| `onCopy` | (files: Array<[File](#-file-structure)>) => void | (Optional) A callback function triggered when one or more files or folders are copied providing copied files as an argument. Use this function to perform custom actions on copy event. |

frontend/CHANGELOG.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
# [1.30.0](https://github.com/Saifullah-dev/react-file-manager/compare/v1.27.0...v1.30.0) (2025-10-07)
2+
3+
### 🧩 Internationalization (i18n)
4+
5+
- **Added:** Portuguese (Portugal) locale support (`pt-PT`)
6+
([#226](https://github.com/Saifullah-dev/react-file-manager/pull/226))
7+
8+
- **Refactored:** All locale imports and resource keys now use **consistent full locale codes**
9+
(e.g., `en-US`, `fr-FR`, `ar-SA`, `pt-BR`, `pt-PT`, etc.) for better clarity and alignment with
10+
[i18next language conventions](https://www.i18next.com/overview/configuration-options#languages-namespace).
11+
12+
### ⚠️ Breaking Changes
13+
14+
- Language codes used in `i18n` initialization have been updated from short forms like `"en"`, `"fr"`, `"pt"`
15+
to **full locale codes** such as `"en-US"`, `"fr-FR"`, `"pt-BR"`, `"pt-PT"`, etc.
16+
- If your application sets or changes languages manually, please update your code accordingly:
17+
18+
```js
19+
// Before
20+
<FileManager language="pt" files={files} />;
21+
22+
// After
23+
<FileManager language="pt-PT" files={files} />;
24+
```
25+
A full list of supported locale keys is available in the documentation.
26+
127
# [1.27.0](https://github.com/Saifullah-dev/react-file-manager/compare/v1.26.3...v1.27.0) (2025-09-12)
228

329
### ✨ Features

frontend/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ type File = {
113113
| `height` | string \| number | The height of the component `default: 600px`. Can be a string (e.g., `'100%'`, `'10rem'`) or a number (in pixels). |
114114
| `initialPath` | string | The path of the directory to be loaded initially e.g. `/Documents`. This should be the path of a folder which is included in `files` array. Default value is `""` |
115115
| `isLoading` | boolean | A boolean state indicating whether the application is currently performing an operation, such as creating, renaming, or deleting a file/folder. Displays a loading state if set `true`. |
116-
| `language` | string | A language code used for translations (e.g., `"en"`, `"fr"`, `"tr"`). Defaults to `"en"` for English. Allows the user to set the desired translation language manually. |
116+
| `language` | string | A language code used for translations (e.g., `"en-US"`, `"fr-FR"`, `"tr-TR"`). Defaults to `"en-US"` for English. Allows the user to set the desired translation language manually. <br><br>**Available languages:** <br> 🇸🇦 `ar-SA` (Arabic, Saudi Arabia) <br> 🇩🇪 `de-DE` (German, Germany) <br> 🇺🇸 `en-US` (English, United States) <br> 🇪🇸 `es-ES` (Spanish, Spain) <br> 🇫🇷 `fr-FR` (French, France) <br> 🇮🇱 `he-IL` (Hebrew, Israel) <br> 🇮🇳 `hi-IN` (Hindi, India) <br> 🇮🇹 `it-IT` (Italian, Italy) <br> 🇯🇵 `ja-JP` (Japanese, Japan) <br> 🇰🇷 `ko-KR` (Korean, South Korea) <br> 🇧🇷 `pt-BR` (Portuguese, Brazil) <br> 🇵🇹 `pt-PT` (Portuguese, Portugal) <br> 🇷🇺 `ru-RU` (Russian, Russia) <br> 🇹🇷 `tr-TR` (Turkish, Turkey) <br> 🇺🇦 `uk-UA` (Ukrainian, Ukraine) <br> 🇵🇰 `ur-UR` (Urdu, Pakistan) <br> 🇻🇳 `vi-VN` (Vietnamese, Vietnam) <br> 🇨🇳 `zh-CN` (Chinese, Simplified) <br> 🇵🇱 `pl-PL` (Polish, Poland) |
117117
| `layout` | "list" \| "grid" | Specifies the default layout style for the file manager. Can be either "list" or "grid". Default value is "grid". |
118118
| `maxFileSize` | number | For limiting the maximum upload file size in bytes. |
119119
| `onCopy` | (files: Array<[File](#-file-structure)>) => void | (Optional) A callback function triggered when one or more files or folders are copied providing copied files as an argument. Use this function to perform custom actions on copy event. |

frontend/src/FileManager/FileManager.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ const FileManager = ({
4949
filePreviewComponent,
5050
primaryColor = "#6155b4",
5151
fontFamily = "Nunito Sans, sans-serif",
52-
language = "en",
52+
language = "en-US",
5353
permissions: userPermissions = {},
5454
collapsibleNav = false,
5555
defaultNavExpanded = true,

frontend/src/i18n.js

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
11
import i18n from "i18next";
2-
import ar from "./locales/ar-SA.json";
3-
import de from "./locales/de-DE.json";
4-
import en from "./locales/en-US.json";
5-
import es from "./locales/es-ES.json";
6-
import fr from "./locales/fr-FR.json";
7-
import he from "./locales/he-IL.json";
8-
import hi from "./locales/hi-IN.json";
9-
import it from "./locales/it-IT.json";
10-
import ja from "./locales/ja-JP.json";
11-
import ko from "./locales/ko-KR.json";
12-
import pt from "./locales/pt-BR.json";
13-
import ru from "./locales/ru-RU.json";
14-
import tr from "./locales/tr-TR.json";
15-
import uk from "./locales/uk-UA.json";
16-
import ur from "./locales/ur-UR.json";
17-
import vi from "./locales/vi-VN.json";
18-
import zh from "./locales/zh-CN.json";
19-
import pl from "./locales/pl-PL.json";
2+
import arSA from "./locales/ar-SA.json";
3+
import deDE from "./locales/de-DE.json";
4+
import enUS from "./locales/en-US.json";
5+
import esES from "./locales/es-ES.json";
6+
import frFR from "./locales/fr-FR.json";
7+
import heIL from "./locales/he-IL.json";
8+
import hiIN from "./locales/hi-IN.json";
9+
import itIT from "./locales/it-IT.json";
10+
import jaJP from "./locales/ja-JP.json";
11+
import koKR from "./locales/ko-KR.json";
12+
import ptBR from "./locales/pt-BR.json";
13+
import ptPT from "./locales/pt-PT.json";
14+
import ruRU from "./locales/ru-RU.json";
15+
import trTR from "./locales/tr-TR.json";
16+
import ukUA from "./locales/uk-UA.json";
17+
import urUR from "./locales/ur-UR.json";
18+
import viVN from "./locales/vi-VN.json";
19+
import zhCN from "./locales/zh-CN.json";
20+
import plPL from "./locales/pl-PL.json";
2021

2122
const resources = {
22-
ar: { translation: ar },
23-
de: { translation: de },
24-
en: { translation: en },
25-
es: { translation: es },
26-
fr: { translation: fr },
27-
he: { translation: he },
28-
hi: { translation: hi },
29-
it: { translation: it },
30-
ja: { translation: ja },
31-
ko: { translation: ko },
32-
pt: { translation: pt },
33-
ru: { translation: ru },
34-
tr: { translation: tr },
35-
uk: { translation: uk },
36-
ur: { translation: ur },
37-
vi: { translation: vi },
38-
zh: { translation: zh },
39-
pl: { translation: pl },
23+
"ar-SA": { translation: arSA },
24+
"de-DE": { translation: deDE },
25+
"en-US": { translation: enUS },
26+
"es-ES": { translation: esES },
27+
"fr-FR": { translation: frFR },
28+
"he-IL": { translation: heIL },
29+
"hi-IN": { translation: hiIN },
30+
"it-IT": { translation: itIT },
31+
"ja-JP": { translation: jaJP },
32+
"ko-KR": { translation: koKR },
33+
"pt-BR": { translation: ptBR },
34+
"pt-PT": { translation: ptPT },
35+
"ru-RU": { translation: ruRU },
36+
"tr-TR": { translation: trTR },
37+
"uk-UA": { translation: ukUA },
38+
"ur-UR": { translation: urUR },
39+
"vi-VN": { translation: viVN },
40+
"zh-CN": { translation: zhCN },
41+
"pl-PL": { translation: plPL },
4042
};
4143

42-
export const initI18n = (lng = "en") => {
44+
export const initI18n = (lng = "en-US") => {
4345
if (!i18n.isInitialized) {
4446
i18n.init({
4547
resources,
4648
lng,
47-
fallbackLng: "en",
49+
fallbackLng: "en-US",
4850
interpolation: {
4951
escapeValue: false,
5052
},

frontend/src/locales/pt-PT.json

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"newFolder": "Nova pasta",
3+
"upload": "Carregar",
4+
"paste": "Colar",
5+
"changeView": "Mudar vista",
6+
"refresh": "Atualizar",
7+
"cut": "Cortar",
8+
"copy": "Copiar",
9+
"rename": "Renomear",
10+
"download": "Transferir",
11+
"delete": "Eliminar",
12+
"itemSelected": "item selecionado",
13+
"itemsSelected": "itens selecionados",
14+
"cancel": "Cancelar",
15+
"clearSelection": "Limpar seleção",
16+
"completed": "Concluído",
17+
"fileNameChangeWarning": "Se alterar a extensão de um ficheiro, este pode deixar de funcionar corretamente. Tem a certeza de que deseja alterá-la?",
18+
"no": "Não",
19+
"yes": "Sim",
20+
"close": "Fechar",
21+
"fileTypeNotAllowed": "Tipo de ficheiro não permitido.",
22+
"fileAlreadyExist": "O ficheiro já existe.",
23+
"maxUploadSize": "O tamanho máximo de carregamento é",
24+
"dragFileToUpload": "Arraste os ficheiros para carregar",
25+
"chooseFile": "Escolher ficheiro",
26+
"uploadFail": "Falha no carregamento.",
27+
"uploading": "A carregar",
28+
"uploaded": "Carregado",
29+
"remove": "Remover",
30+
"abortUpload": "Cancelar carregamento",
31+
"preview": "Pré-visualizar",
32+
"previewUnavailable": "Lamentamos! A pré-visualização não está disponível para este ficheiro.",
33+
"home": "Início",
34+
"showMoreFolder": "Mostrar mais pastas",
35+
"moveTo": "Mover para",
36+
"folderEmpty": "Esta pasta está vazia.",
37+
"selectAll": "Selecionar tudo",
38+
"view": "Vista",
39+
"grid": "Grelha",
40+
"list": "Lista",
41+
"open": "Abrir",
42+
"nothingHereYet": "Ainda não há nada aqui",
43+
"name": "Nome",
44+
"modified": "Modificado",
45+
"size": "Tamanho",
46+
"deleteItemConfirm": "Tem a certeza de que deseja eliminar \"{{fileName}}\"?",
47+
"deleteItemsConfirm": "Tem a certeza de que deseja eliminar estes {{count}} itens?",
48+
"percentDone": "{{percent}}% concluído",
49+
"canceled": "Cancelado",
50+
"invalidFileName": "O nome do ficheiro não pode conter nenhum dos seguintes caracteres: \\ / : * ? \" < > |",
51+
"folderExists": "O destino já contém uma pasta chamada \"{{renameFile}}\".",
52+
"collapseNavigationPane": "Recolher painel de navegação",
53+
"expandNavigationPane": "Expandir painel de navegação"
54+
}

0 commit comments

Comments
 (0)