Skip to content

Commit

Permalink
feat(hu-HU): add autogenerated locale hu-HU. Closes #195 (#203)
Browse files Browse the repository at this point in the history
Co-authored-by: Péter Gyarmati <dev.petergy@gmail.com>
  • Loading branch information
runeb and peter-gy authored Jan 5, 2024
1 parent 1ccdeda commit e953248
Show file tree
Hide file tree
Showing 16 changed files with 2,418 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ More information on being a maintainer, contributing to this project and a demo
| [Finnish / Suomi](https://github.com/sanity-io/locales/tree/main/locales/fi-FI) | [@sanity/locale-fi-fi](https://www.npmjs.com/package/@sanity/locale-fi-fi) | [Join](https://github.com/sanity-io/locales/issues/new?assignees=&labels=&projects=&template=request-maintainer.md&title=Maintainer%3A+fi-FI) |
| [French / Français](https://github.com/sanity-io/locales/tree/main/locales/fr-FR) | [@sanity/locale-fr-fr](https://www.npmjs.com/package/@sanity/locale-fr-fr) ||
| [German / Deutsch](https://github.com/sanity-io/locales/tree/main/locales/de-DE) | [@sanity/locale-de-de](https://www.npmjs.com/package/@sanity/locale-de-de) ||
| [Hungarian / Magyar](https://github.com/sanity-io/locales/tree/main/locales/hu-HU) | [@sanity/locale-hu-hu](https://www.npmjs.com/package/@sanity/locale-hu-hu) ||
| [Icelandic / Íslenska](https://github.com/sanity-io/locales/tree/main/locales/is-IS) | [@sanity/locale-is-is](https://www.npmjs.com/package/@sanity/locale-is-is) | [Join](https://github.com/sanity-io/locales/issues/new?assignees=&labels=&projects=&template=request-maintainer.md&title=Maintainer%3A+is-IS) |
| [Italian / Italiano](https://github.com/sanity-io/locales/tree/main/locales/it-IT) | [@sanity/locale-it-it](https://www.npmjs.com/package/@sanity/locale-it-it) ||
| [Japanese / 日本語](https://github.com/sanity-io/locales/tree/main/locales/ja-JP) | [@sanity/locale-ja-jp](https://www.npmjs.com/package/@sanity/locale-ja-jp) | [Join](https://github.com/sanity-io/locales/issues/new?assignees=&labels=&projects=&template=request-maintainer.md&title=Maintainer%3A+ja-JP) |
Expand Down
2 changes: 2 additions & 0 deletions apps/studio/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {deDELocale} from '@sanity/locale-de-de'
import {esESLocale} from '@sanity/locale-es-es'
import {fiFILocale} from '@sanity/locale-fi-fi'
import {frFRLocale} from '@sanity/locale-fr-fr'
import {huHULocale} from '@sanity/locale-hu-hu'
import {isISLocale} from '@sanity/locale-is-is'
import {itITLocale} from '@sanity/locale-it-it'
import {jaJPLocale} from '@sanity/locale-ja-jp'
Expand All @@ -30,6 +31,7 @@ export const locales = [
esESLocale(),
fiFILocale(),
frFRLocale(),
huHULocale(),
isISLocale(),
itITLocale(),
jaJPLocale(),
Expand Down
1 change: 1 addition & 0 deletions apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"@sanity/locale-es-es": "workspace:*",
"@sanity/locale-fi-fi": "workspace:*",
"@sanity/locale-fr-fr": "workspace:*",
"@sanity/locale-hu-hu": "workspace:*",
"@sanity/locale-is-is": "workspace:*",
"@sanity/locale-it-it": "workspace:*",
"@sanity/locale-ja-jp": "workspace:*",
Expand Down
1 change: 1 addition & 0 deletions apps/studio/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@sanity/locale-es-es": ["../../locales/es-ES/src"],
"@sanity/locale-fi-fi": ["../../locales/fi-FI/src"],
"@sanity/locale-fr-fr": ["../../locales/fr-FR/src"],
"@sanity/locale-hu-hu": ["../../locales/hu-HU/src"],
"@sanity/locale-is-is": ["../../locales/is-IS/src"],
"@sanity/locale-it-it": ["../../locales/it-IT/src"],
"@sanity/locale-ja-jp": ["../../locales/ja-JP/src"],
Expand Down
21 changes: 21 additions & 0 deletions locales/hu-HU/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Sanity.io

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
57 changes: 57 additions & 0 deletions locales/hu-HU/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# @sanity/locale-hu-hu

Hungarian / Magyar language support for [Sanity Studio](https://www.sanity.io/).

## Description

This is a community maintained language plugin. Initial translations were done by AI and may have errors. Contributions are [more than welcome](#contributing)!

## Installation

```sh
npm install @sanity/locale-hu-hu
```

## Usage

```ts
// sanity.config.ts / sanity.config.js:
import {defineConfig} from 'sanity'
import {huHULocale} from '@sanity/locale-hu-hu'

export default defineConfig({
// ...
plugins: [
// ... other plugins here ...
huHULocale(),
],
})
```

The language should now show up in the Studio's user menu.

If you want to customize the title of the locale, pass it as an option to the plugin:

```ts
// sanity.config.ts / sanity.config.js:
import {defineConfig} from 'sanity'
import {huHULocale} from '@sanity/locale-hu-hu'

export default defineConfig({
// ...
plugins: [
// ... other plugins here ...
huHULocale({
title: 'Hungarian',
}),
],
})
```

## Contributing

Feel free to contribute improvements/changes! The strings are located in the `src` folder, where the file name represents the "namespace". Send a pull request, and feel free to add yourself to the `contributors` array in `locales/registry.ts`. If you want to help review new translations, add yourself to the `maintainers` array instead. After doing your changes, run `pnpm run reconcile` and add the changes to version control.

## License

MIT-licensed. See LICENSE.
6 changes: 6 additions & 0 deletions locales/hu-HU/package.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import {defineConfig} from '@sanity/pkg-utils'

export default defineConfig({
tsconfig: '../../tsconfig.locale.json',
minify: true,
})
61 changes: 61 additions & 0 deletions locales/hu-HU/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@sanity/locale-hu-hu",
"version": "1.0.0",
"private": false,
"description": "Hungarian / Magyar locale/translation for Sanity Studio",
"keywords": [
"sanity",
"i18n",
"locale",
"localization",
"hu-HU"
],
"homepage": "https://github.com/sanity-io/locales#readme",
"bugs": {
"url": "https://github.com/sanity-io/locales/issues"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/sanity-io/locales.git",
"directory": "locales/hu-HU"
},
"license": "MIT",
"contributors": [
{
"name": "peter-gy",
"url": "https://github.com/peter-gy"
}
],
"type": "module",
"exports": {
".": {
"types": "./dist/index.d.ts",
"source": "./src/index.ts",
"import": "./dist/index.js",
"require": "./dist/index.cjs",
"default": "./dist/index.js"
},
"./package.json": "./package.json"
},
"main": "./dist/index.cjs",
"module": "./dist/index.js",
"source": "./src/index.ts",
"types": "./dist/index.d.ts",
"files": [
"dist",
"src"
],
"scripts": {
"build": "npm run clean && npm run pkg:build && npm run pkg:check",
"clean": "rimraf dist",
"pkg:build": "pkg build --strict",
"pkg:check": "pkg check --strict",
"prepublishOnly": "pnpm build"
},
"peerDependencies": {
"sanity": "^3.22.0"
},
"publishConfig": {
"access": "public"
}
}
47 changes: 47 additions & 0 deletions locales/hu-HU/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {defineLocale, definePlugin, type LocaleDefinition} from 'sanity'

const locale = defineLocale({
id: 'hu-HU',
title: 'Magyar',
bundles: [
{
namespace: 'structure',
resources: () => import('./structure'),
},

{
namespace: 'studio',
resources: () => import('./studio'),
},

{
namespace: 'validation',
resources: () => import('./validation'),
},

{
namespace: 'vision',
resources: () => import('./vision'),
},
],
weekInfo: {
firstDay: 1,
minimalDays: 4,
weekend: [6, 7],
},
})

/**
* Magyar / Hungarian locale/translation plugin for Sanity Studio
*
* @public
*/
export const huHULocale = definePlugin<{
title?: string
weekInfo?: LocaleDefinition['weekInfo']
} | void>((config) => ({
name: '@sanity/locale-hu-hu',
i18n: {
locales: [config ? {...locale, ...config} : locale],
},
}))
Loading

0 comments on commit e953248

Please sign in to comment.