@ -14,22 +14,20 @@ If you are new to Homepage widgets, and are looking to create a new widget, plea
All text and numerical content in widgets should be translated and localized. English is the default language, and other languages can be added via [Crowdin](https://crowdin.com/project/gethomepage).
The Homepage community prides itself on being multilingual, and we strongly encourage you to add translations for your widgets.
If you are looking to learn more about translations, please refer to the guide here: [Translations Guide](translations.md).
To learn more about translations, please refer to the guide here: [Translations Guide](translations.md).
### Widget Component
The widget component is the core of the widget. It is responsible for [fetching data from the API](api.md) and rendering the widget UI. Homepage provides a set of hooks and utilities to help you build your widget component.
If you are looking to learn more about widget components, please refer to the guide here: [Component Guide](component.md).
To learn more about widget components, please refer to the guide here: [Component Guide](component.md).
### Widget Metadata
Widget metadata defines the configuration of the widget. It defines the API endpoint to fetch data from, the proxy handler to use, and any data mappings.
If you are looking to learn more about widget metadata, endpoint and data mapping, please refer to the guide here: [Metadata Guide](metadata.md).
To learn more about widget metadata, endpoint and data mapping, please refer to the guide here: [Metadata Guide](metadata.md).
If you are looking to learn more about proxy handlers, please refer to the guide here: [Proxies Guide](proxies.md).
To learn more about proxy handlers, please refer to the guide here: [Proxies Guide](proxies.md).
If you are looking to learn more making API calls from inside your widget, please refer to the guide here: [API Guide](api.md).
To learn more about making API calls from inside your widget, please refer to the guide here: [API Guide](api.md).
@ -5,8 +5,6 @@ description: Tips and tricks for translating and localizing Homepage widgets.
All text and numerical content in widgets should be translated and localized. English is the default language, and other languages can be added via [Crowdin](https://crowdin.com/project/gethomepage).
The Homepage community prides itself on being multilingual, and we strongly encourage you to add translations for your widgets.
## Translations
Homepage uses the [next-i18next](https://github.com/i18next/next-i18next) library to handle translations. This library provides a set of hooks and utilities to help you localize your widgets, and Homepage has extended this library to support additional features.
@ -32,15 +30,25 @@ Homepage uses the [next-i18next](https://github.com/i18next/next-i18next) librar
}
```
=== "en.json"
## Set up translation strings
```json
"yourwidget": {
"key1": "Value 1",
"key2": "Value 2",
"key3": "Value 3"
}
```
Homepage uses translated and localized strings for **all text and numerical content** in widgets. English is the default language, and other languages can be added via [Crowdin](https://crowdin.com/project/gethomepage). To add the English translations for your widget, follow these steps:
Open the `public/locales/en/common.js` file.
Add a new object for your widget to the bottom of the list, like this:
```json
"yourwidget": {
"key1": "Value 1",
"key2": "Value 2",
"key3": "Value 3"
}
```
!!! note
Even if you natively speak another language, you should only add English translations. You can then add translations in your native language via [Crowdin](https://crowdin.com/project/gethomepage), once your widget is merged.
All widgets that fetch data from dynamic endpoints should have either `mappings` or an `allowedEndpoints` property.
## Set up translation strings
## Including translation strings in your widget
Homepage uses translated and localized strings for **all text and numerical content** in widgets. English is the default language, and other languages can be added via [Crowdin](https://crowdin.com/project/gethomepage). To add the English translations for your widget, follow these steps:
Open the `public/locales/en/common.js` file.
Add a new object for your widget to the bottom of the list, like this:
```json
"yourwidget": {
"key1": "Value 1",
"key2": "Value 2",
"key3": "Value 3"
}
```
!!! note
Even if you nativly speak another language, you should only add English translations. You can then add translations in your native language via [Crowdin](https://crowdin.com/project/gethomepage), once your widget is merged.
Refer to the [translations guide](translations.md) for more details. The Homepage community prides itself on being multilingual, and we strongly encourage you to add translations for your widgets.