Skip to content

Commit b333d8c

Browse files
committed
docs: reorganize contributing guide and add section for i18n package contributions
1 parent 8e318fa commit b333d8c

File tree

1 file changed

+92
-10
lines changed

1 file changed

+92
-10
lines changed

CONTRIBUTING.md

Lines changed: 92 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ This guide walks you through setting up the development environment and other im
1313
- [JSON Sort Order](#json-sort-order)
1414
- [Setting up the Source Code](#setting-up-the-source-code)
1515
- [Setting up the Development Environment](#setting-up-the-development-environment)
16-
- [Contributing to the Documentation](#contributing-to-the-documentation)
1716
- [Commit Message Guidelines](#commit-message-guidelines)
1817
- [Commit Message Header](#commit-header)
1918
- [Type](#type)
@@ -22,6 +21,7 @@ This guide walks you through setting up the development environment and other im
2221
- [Commit Message Body](#commit-body)
2322
- [Commit Message Footer](#commit-footer)
2423
- [Revert commits](#revert-commits)
24+
- [Contributing to the Documentation](#contributing-to-the-documentation)
2525

2626
## Prerequisite Software
2727

@@ -71,15 +71,6 @@ pnpm install
7171
pnpm build
7272
```
7373

74-
## Contributing to the Documentation
75-
76-
The documentation for Asgardeo JavaScript SDKs is maintained in the Asgardeo / WSO2 Identity Server Official Docs site.
77-
78-
- [Asgardeo Docs](https://wso2.com/asgardeo/docs)
79-
- [WSO2 Identity Server Docs](https://is.docs.wso2.com/en/latest/)
80-
81-
To contribute to the documentation, please send a pull request to the [Asgardeo Docs repository](https://github.com/wso2/docs-is).
82-
8374
## Commit Message Guidelines
8475

8576
We use [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) as the commit message convention.
@@ -158,3 +149,94 @@ The content of the commit message body should contain:
158149

159150
- Information about the SHA of the commit being reverted in the following format: `This reverts commit <SHA>`.
160151
- A clear description of the reason for reverting the commit message.
152+
153+
## Contributing
154+
155+
### Contributing to the Internalization (i18n) Package
156+
157+
The `@asgardeo/i18n` package provides internationalization support for Asgardeo JavaScript SDKs. To add support for a new language, follow these steps:
158+
159+
#### Adding a New Language
160+
161+
##### Create a new language file
162+
163+
Navigate to [`packages/i18n/src/translations/`](../packages/i18n/src/translations/) and create a new TypeScript file for your language.
164+
Use the correct [IETF BCP 47 language tag](https://datatracker.ietf.org/doc/html/bcp47) (which combines [ISO 639-1 language codes](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) and [ISO 3166-1 country codes](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)).
165+
For example:
166+
167+
- `fr-FR.ts` → French (France)
168+
- `es-ES.ts` → Spanish (Spain)
169+
- `en-US.ts` → English (United States)
170+
171+
##### Copy the structure from the existing language file
172+
173+
Use the English (`en-US.ts`) file as a template to ensure you have all the required translation keys:
174+
175+
```bash
176+
cp packages/i18n/src/translations/en-US.ts packages/i18n/src/translations/<locale-code>.ts
177+
```
178+
179+
##### Update the translations and metadata
180+
181+
Open your new language file and:
182+
183+
- Translate all the text values in the `translations` object while keeping the keys unchanged
184+
- Update the `metadata` object with the correct locale information
185+
186+
```typescript
187+
const translations: I18nTranslations = {
188+
'elements.buttons.signIn': 'Se connecter',
189+
'elements.buttons.signOut': 'Se déconnecter',
190+
// ... translate all other keys
191+
};
192+
193+
const metadata: I18nMetadata = {
194+
localeCode: 'fr-FR',
195+
countryCode: 'FR',
196+
languageCode: 'fr',
197+
displayName: 'Français (France)',
198+
direction: 'ltr', // or 'rtl' for right-to-left languages
199+
};
200+
```
201+
202+
##### Export the new language bundle
203+
204+
At the end of your new language file, export the bundle:
205+
206+
```typescript
207+
const fr_FR: I18nBundle = {
208+
metadata,
209+
translations,
210+
};
211+
212+
export default fr_FR;
213+
```
214+
215+
##### Add the export to the translations index
216+
217+
Add your new language to the translations export file at `packages/i18n/src/translations/index.ts`:
218+
219+
```typescript
220+
export {default as fr_FR} from './fr-FR';
221+
```
222+
223+
##### Test your translation
224+
225+
Build the package and test the new language in a sample application to ensure all translations are working correctly:
226+
227+
```bash
228+
pnpm build --filter @asgardeo/i18n
229+
```
230+
231+
##### Update documentation
232+
233+
Update any relevant documentation to mention the newly supported language.
234+
235+
### Contributing to the Documentation
236+
237+
The documentation for Asgardeo JavaScript SDKs is maintained in the Asgardeo / WSO2 Identity Server Official Docs site.
238+
239+
- [Asgardeo Docs](https://wso2.com/asgardeo/docs)
240+
- [WSO2 Identity Server Docs](https://is.docs.wso2.com/en/latest/)
241+
242+
To contribute to the documentation, please send a pull request to the [Asgardeo Docs repository](https://github.com/wso2/docs-is).

0 commit comments

Comments
 (0)