-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Péter Gyarmati <dev.petergy@gmail.com>
- Loading branch information
Showing
16 changed files
with
2,418 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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], | ||
}, | ||
})) |
Oops, something went wrong.