Skip to content

Commit

Permalink
feat(zh-CN): autogenerated locale zh-CN (#25)
Browse files Browse the repository at this point in the history
  • Loading branch information
runeb authored Dec 7, 2023
1 parent 50a0cb5 commit 1e58fcd
Show file tree
Hide file tree
Showing 13 changed files with 2,071 additions and 0 deletions.
5 changes: 5 additions & 0 deletions apps/studio/locales.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {nbNOLocale} from '@sanity/locale-nb-no'
import {nnNOLocale} from '@sanity/locale-nn-no'
import {ptBRLocale} from '@sanity/locale-pt-br'
import {ptPTLocale} from '@sanity/locale-pt-pt'
import {zhCNLocale} from '@sanity/locale-zh-cn'
import {zhHKLocale} from '@sanity/locale-zh-hk'
import {zhTWLocale} from '@sanity/locale-zh-tw'
import {svSELocale} from '@sanity/locale-sv-se'
Expand All @@ -30,11 +31,15 @@ export const locales = [
ptBRLocale(),
ptPTLocale(),
<<<<<<< HEAD
<<<<<<< HEAD
zhCNLocale(),
=======
<<<<<<< HEAD
zhHKLocale(),
=======
zhTWLocale(),
>>>>>>> main
>>>>>>> main
=======
svSELocale(),
trTRLocale(),
Expand Down
1 change: 1 addition & 0 deletions apps/studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@sanity/locale-nn-no": "workspace:*",
"@sanity/locale-pt-br": "workspace:*",
"@sanity/locale-pt-pt": "workspace:*",
"@sanity/locale-zh-cn": "workspace:*",
"@sanity/locale-zh-hk": "workspace:*",
"@sanity/locale-zh-tw": "workspace:*",
"@sanity/locale-sv-se": "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 @@ -13,6 +13,7 @@
"@sanity/locale-nn-no": ["../../locales/nn-NO/src"],
"@sanity/locale-pt-br": ["../../locales/pt-BR/src"],
"@sanity/locale-pt-pt": ["../../locales/pt-PT/src"],
"@sanity/locale-zh-cn": ["../../locales/zh-CN/src"],
"@sanity/locale-zh-hk": ["../../locales/zh-HK/src"],
"@sanity/locale-zh-tw": ["../../locales/zh-TW/src"],
"@sanity/locale-sv-se": ["../../locales/sv-SE/src"],
Expand Down
7 changes: 7 additions & 0 deletions locales/registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ const registry: LocaleRegistry = [
contributors: [],
isOfficial: false,
},
{
id: 'zh-CN',
name: '简体中文',
maintainers: [],
contributors: [],
isOfficial: false,
},
{
id: 'zh-HK',
name: '中文(香港)',
Expand Down
21 changes: 21 additions & 0 deletions locales/zh-CN/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.
6 changes: 6 additions & 0 deletions locales/zh-CN/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,
})
52 changes: 52 additions & 0 deletions locales/zh-CN/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "@sanity/locale-zh-cn",
"version": "1.0.0",
"private": false,
"description": "简体中文 locale/translation for Sanity Studio",
"keywords": [
"sanity",
"i18n",
"locale",
"localization",
"zh-CN"
],
"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/zh-CN"
},
"license": "MIT",
"contributors": [],
"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"
},
"peerDependencies": {
"sanity": "^3.21.0"
}
}
39 changes: 39 additions & 0 deletions locales/zh-CN/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import {defineLocale, definePlugin} from 'sanity'

const locale = defineLocale({
id: 'zh-CN',
title: '简体中文',
bundles: [
{
namespace: 'structure',
resources: () => import('./structure'),
},

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

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

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

/**
* 简体中文 locale/translation plugin for Sanity Studio
*
* @public
*/
export const zhCNLocale = definePlugin({
name: '@sanity/locale-zh-cn',
i18n: {
locales: [locale],
},
})
Loading

0 comments on commit 1e58fcd

Please sign in to comment.