Skip to content

Commit

Permalink
feat: add i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
jesperorb committed Mar 30, 2024
1 parent 59f37da commit b5af18d
Show file tree
Hide file tree
Showing 47 changed files with 1,673 additions and 479 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"editor.defaultFormatter": "svelte.svelte-vscode"
},
"editor.codeActionsOnSave": {
"source.fixAll": "explicit"
"source.fixAll": "always"
}
}
14 changes: 13 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Reading and following these guidelines will help us make the contribution proces
- [Getting Started](#getting-started)
- [Issues](#issues)
- [Pull Requests](#pull-requests)
- [Adding Translations](#adding-translations)
- [License](#license)

## Getting Started
Expand Down Expand Up @@ -38,6 +39,17 @@ In general, we follow the ["fork-and-pull" Git workflow](https://github.com/susa
6. Push changes to your fork
7. Open a PR in our repository and follow the PR template so that we can efficiently review the changes.

### License
## Adding Translations

1. Fork and clone the repository to your local machine
2. Create a new branch for your translation with the name `feat/translations/<language-code>` (e.g. `feat/translations/es`)
3. Add your language code to the property `languageTags` to the file [./project.inlang/settings.json](./project.inlang/settings.json)
4. Add a file with the name of your language code in the folder [./messages](./messages) (e.g. `es.json`)
5. Copy contents of the file [./messages/en.json](./messages/en.json) to your new file and start translating the strings.
6. Run project locally and check if your translations are working as expected.
- You can change language under "Settings" in the top right corner of the page.
7. Commit your changes and push to your fork and open a PR to this repository.

## License

By contributing, you agree that your contributions will be licensed under its MIT License.
61 changes: 61 additions & 0 deletions messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"about": "About",
"alternativeUseHeading": "Alternativ use",
"alternativeUseIngress": "{method} can also be used from",
"amount": "Amount",
"and": "and",
"availableInBrowser": "Available in {browserName} from version {versionAdded}",
"blurbPart1": "is a tool for experimenting and trying out the",
"blurbPart2": "The API is available under the namespace",
"blurbPart3": "in JavaScript and provides language sensitive datetime formatting, number formatting, string comparison and more.",
"blurbPart4": "To get started either visit",
"blurbPart5": "or choose formatter you are interested in from the navigation menu.",
"blurbPart6": "The source code for this tool can be found at",
"blurbPart7": "The creator of this tool is",
"blurbWelcome": "Welcome to Intl Explorer!",
"browserDetails": "Browser details",
"browserSupport": "Browser support",
"close": "Close",
"code": "Code",
"codeTheme": "Code Theme",
"codeThemeHint": "Theme for code blocks: OceanicNext/Github",
"confirmLanguage": "Confirm language",
"copyCode": "Copy Code",
"copyCodeAriaLabel": "Copy code for options: {code}",
"copySchemaUrl": "Copy Schema URL",
"currency": "Currency",
"dark": "Dark",
"date": "Date",
"equals": "equals",
"fullSupport": "Full support",
"input": "Input",
"language": "Language",
"languageHint": "Language for page. Press Confirm to reload page with selected language",
"light": "Light",
"list": "List",
"locale": "Locale",
"menu": "Menu",
"meta": "Meta",
"method": "Method",
"no": "No",
"noSupport": "No support",
"notAvailableInBrowser": "Not available in {browserName}",
"options": "Options",
"output": "Output",
"partialSupport": "Partial support",
"resolvedOptions": "Resolved Options",
"secondaryFormatters": "Secondary Formatters",
"seeAlso": "See also",
"selectCurrency": "Select a currency",
"selectUnit": "Select a unit",
"settingsButton": "Settings",
"settingsHeading": "Settings",
"skipLink": "Skip to content",
"specification": "Specification",
"theme": "Theme",
"themeHint": "Page theme",
"time": "Time",
"unit": "Unit",
"value": "Value"
}
61 changes: 61 additions & 0 deletions messages/sv.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"$schema": "https://inlang.com/schema/inlang-message-format",
"about": "Om",
"alternativeUseHeading": "Alternativ användning",
"alternativeUseIngress": "{method} kan också användas från",
"amount": "Summa",
"and": "och",
"availableInBrowser": "Tillgänglig i {browserName} från version {versionAdded}",
"blurbPart1": "är ett verktyg för att experimentera med",
"blurbPart2": "APIet är tillgängligt under namnet",
"blurbPart3": "i JavaScript och ger en språkkänslig datumformattering, nummerformattering, strängjämförelse med mera.",
"blurbPart4": "För att börja antingen besök",
"blurbPart5": "eller välj en formatterare du är intresserad av i navigationsmenyn.",
"blurbPart6": "Källkoden för detta verktyg hittas på",
"blurbPart7": "Skaparen av detta verktyg är",
"blurbWelcome": "Välkommen till Intl Explorer!",
"browserDetails": "Webbläsardetaljer",
"browserSupport": "Webbläsarstöd",
"close": "Stäng",
"code": "Kod",
"codeTheme": "Kodtema",
"codeThemeHint": "Tema för kodblock: OceanicNext/Github",
"confirmLanguage": "Bekräfta språk",
"copyCode": "Kopiera kod",
"copyCodeAriaLabel": "Kopiera kod för alternativ: {code}",
"copySchemaUrl": "Kopiera Schema URL",
"currency": "Valuta",
"dark": "Mörkt",
"date": "Datum",
"equals": "är lika med",
"fullSupport": "Fullt stöd",
"input": "Indata",
"language": "Språk",
"languageHint": "Språk för sidan. Bekräfta språk för att ladda om sidan med valda språk.",
"light": "Ljust",
"list": "Lista",
"locale": "Språk",
"menu": "Meny",
"meta": "Meta",
"method": "Metod",
"no": "Nej",
"noSupport": "Inget stöd",
"notAvailableInBrowser": "Inte tillgänglig i {browserName}",
"options": "Alternativ",
"output": "Utdata",
"partialSupport": "Delvis stöd",
"resolvedOptions": "Alternativ som används",
"secondaryFormatters": "Sekundära formatterare",
"seeAlso": "Se också",
"selectCurrency": "Välj valuta",
"selectUnit": "Välj enhet",
"settingsButton": "Inställningar",
"settingsHeading": "Inställningar",
"skipLink": "Hoppa till innehåll",
"specification": "Specifikation",
"theme": "Tema",
"themeHint": "Tema för sida",
"time": "Tid",
"unit": "Enhet",
"value": "Värde"
}
41 changes: 23 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"build": "paraglide-js compile --project ./project.inlang && vite build",
"preview": "vite preview",
"test": "vitest",
"test:e2e": "playwright test",
Expand All @@ -18,38 +18,43 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"prepare": "husky install"
"prepare": "husky install",
"postinstall": "paraglide-js compile --project ./project.inlang"
},
"devDependencies": {
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@mdn/browser-compat-data": "5.5.9",
"@playwright/test": "^1.41.2",
"@sveltejs/adapter-vercel": "5.1.0",
"@sveltejs/kit": "2.5.0",
"@inlang/paraglide-js": "1.3.5",
"@mdn/browser-compat-data": "5.5.17",
"@playwright/test": "^1.42.1",
"@sveltejs/adapter-vercel": "5.2.0",
"@sveltejs/kit": "2.5.5",
"@sveltejs/vite-plugin-svelte": "^3.0.2",
"@testing-library/svelte": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"axe-playwright": "^2.0.1",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-svelte": "^2.35.1",
"highlight.js": "^11.9.0",
"husky": "^9.0.10",
"husky": "^9.0.11",
"jsdom": "^24.0.0",
"playwright": "^1.41.2",
"playwright-core": "^1.41.2",
"prettier": "^3.2.4",
"prettier-plugin-svelte": "^3.1.2",
"svelte": "^4.2.9",
"svelte-check": "^3.6.3",
"playwright": "^1.42.1",
"playwright-core": "^1.42.1",
"prettier": "^3.2.5",
"prettier-plugin-svelte": "^3.2.2",
"svelte": "^4.2.12",
"svelte-check": "^3.6.8",
"svelte-eslint-parser": "^0.33.1",
"svelte-highlight": "^7.5.0",
"svelte-highlight": "^7.6.0",
"svelte-preprocess": "^5.1.3",
"tslib": "^2.6.2",
"typescript": "^5.4.2",
"vite": "^5.0.12",
"vitest": "^1.2.2"
"typescript": "^5.4.3",
"vite": "^5.2.6",
"vitest": "^1.4.0"
},
"dependencies": {
"@inlang/paraglide-js-adapter-sveltekit": "^0.5.17"
}
}
Loading

0 comments on commit b5af18d

Please sign in to comment.