diff --git a/.eslintignore b/.eslintignore index c5116025..0b91df52 100644 --- a/.eslintignore +++ b/.eslintignore @@ -11,3 +11,4 @@ storybook-static/ .octane-ci/ .bin/ .docksal/ +src/generated/ diff --git a/lit-localize.json b/lit-localize.json new file mode 100644 index 00000000..58092d6d --- /dev/null +++ b/lit-localize.json @@ -0,0 +1,15 @@ +{ + "$schema": "https://raw.githubusercontent.com/lit/lit/main/packages/localize-tools/config.schema.json", + "sourceLocale": "en", + "targetLocales": ["tr-TR"], + "tsConfig": "./tsconfig.json", + "output": { + "mode": "runtime", + "outputDir": "./src/generated/locales", + "localeCodesModule": "./src/generated/locale-codes.ts" + }, + "interchange": { + "format": "xliff", + "xliffDir": "./translations/" + } +} diff --git a/package-lock.json b/package-lock.json index 9468c947..4c2f8c45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@floating-ui/dom": "^1.2.3", "@fontsource-variable/rubik": "^5.0.2", "@lit-labs/react": "^2.0.3", + "@lit/localize": "^0.12.1", "@open-wc/form-control": "^0.7.0", "@open-wc/form-helpers": "^0.2.2", "element-internals-polyfill": "^1.2.3", @@ -22,6 +23,7 @@ "@commitlint/config-conventional": "^16.2.4", "@commitlint/prompt-cli": "^16.2.4", "@custom-elements-manifest/analyzer": "^0.6.3", + "@lit/localize-tools": "^0.7.1", "@open-wc/testing": "^3.1.6", "@rollup/plugin-replace": "^4.0.0", "@storybook/addon-a11y": "7.4.3", @@ -3851,6 +3853,61 @@ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz", "integrity": "sha512-kXOeFbfCm4fFf2A3WwVEeQj55tMZa8c8/f9AKHMobQMkzNUfUj+antR3fRPaZJawsa1aZiP/Da3ndpZrwEe4rQ==" }, + "node_modules/@lit/localize": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/@lit/localize/-/localize-0.12.1.tgz", + "integrity": "sha512-uuF6OO6fjqomCf3jXsJ5cTGf1APYuN88S4Gvo/fjt9YkG4OMaMvpEUqd5oWhyzrJfY+HcenAbLJNi2Cq3H7gdg==", + "dependencies": { + "lit": "^2.0.0 || ^3.0.0" + } + }, + "node_modules/@lit/localize-tools": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@lit/localize-tools/-/localize-tools-0.7.1.tgz", + "integrity": "sha512-qqJw501aEPF1j9QQmiVC25yU1By1DKEUIFgjszIierwr5jJzfVtGTj67D8UU0hF3vA2yAaWxcl4eooM1Yr0zKQ==", + "dev": true, + "dependencies": { + "@lit/localize": "^0.12.0", + "@parse5/tools": "^0.3.0", + "@xmldom/xmldom": "^0.8.2", + "fast-glob": "^3.2.7", + "fs-extra": "^10.0.0", + "jsonschema": "^1.4.0", + "lit": "^2.0.0 || ^3.0.0", + "minimist": "^1.2.5", + "parse5": "^7.1.1", + "source-map-support": "^0.5.19", + "typescript": "~5.2.0" + }, + "bin": { + "lit-localize": "bin/lit-localize.js" + } + }, + "node_modules/@lit/localize-tools/node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/@lit/localize-tools/node_modules/typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/@lit/reactive-element": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.6.1.tgz", @@ -4031,6 +4088,27 @@ "lit-html": "^2.0.0" } }, + "node_modules/@parse5/tools": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@parse5/tools/-/tools-0.3.0.tgz", + "integrity": "sha512-zxRyTHkqb7WQMV8kTNBKWb1BeOFUKXBXTBWuxg9H9hfvQB3IwP6Iw2U75Ia5eyRxPNltmY7E8YAlz6zWwUnjKg==", + "dev": true, + "dependencies": { + "parse5": "^7.0.0" + } + }, + "node_modules/@parse5/tools/node_modules/parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "dependencies": { + "entities": "^4.4.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -8632,6 +8710,15 @@ "integrity": "sha512-j161Z9oiy8k74vchdrQGihfSp7QulrTclCUiPo0D7JF6/RjpXAmB0ThlTAFlSElkgqg0vdFgNAXaX9ZHZy25wQ==", "dev": true }, + "node_modules/@xmldom/xmldom": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", + "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, "node_modules/@yarnpkg/core": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@yarnpkg/core/-/core-2.4.0.tgz", @@ -12137,6 +12224,18 @@ "once": "^1.4.0" } }, + "node_modules/entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true, + "engines": { + "node": ">=0.12" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, "node_modules/envinfo": { "version": "7.10.0", "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", @@ -16939,6 +17038,15 @@ ], "license": "MIT" }, + "node_modules/jsonschema": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", + "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", + "dev": true, + "engines": { + "node": "*" + } + }, "node_modules/JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", @@ -28560,6 +28668,50 @@ "resolved": "https://registry.npmjs.org/@lit-labs/ssr-dom-shim/-/ssr-dom-shim-1.1.1.tgz", "integrity": "sha512-kXOeFbfCm4fFf2A3WwVEeQj55tMZa8c8/f9AKHMobQMkzNUfUj+antR3fRPaZJawsa1aZiP/Da3ndpZrwEe4rQ==" }, + "@lit/localize": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/@lit/localize/-/localize-0.12.1.tgz", + "integrity": "sha512-uuF6OO6fjqomCf3jXsJ5cTGf1APYuN88S4Gvo/fjt9YkG4OMaMvpEUqd5oWhyzrJfY+HcenAbLJNi2Cq3H7gdg==", + "requires": { + "lit": "^2.0.0 || ^3.0.0" + } + }, + "@lit/localize-tools": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/@lit/localize-tools/-/localize-tools-0.7.1.tgz", + "integrity": "sha512-qqJw501aEPF1j9QQmiVC25yU1By1DKEUIFgjszIierwr5jJzfVtGTj67D8UU0hF3vA2yAaWxcl4eooM1Yr0zKQ==", + "dev": true, + "requires": { + "@lit/localize": "^0.12.0", + "@parse5/tools": "^0.3.0", + "@xmldom/xmldom": "^0.8.2", + "fast-glob": "^3.2.7", + "fs-extra": "^10.0.0", + "jsonschema": "^1.4.0", + "lit": "^2.0.0 || ^3.0.0", + "minimist": "^1.2.5", + "parse5": "^7.1.1", + "source-map-support": "^0.5.19", + "typescript": "~5.2.0" + }, + "dependencies": { + "parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "requires": { + "entities": "^4.4.0" + } + }, + "typescript": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.2.2.tgz", + "integrity": "sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==", + "dev": true + } + } + }, "@lit/reactive-element": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/@lit/reactive-element/-/reactive-element-1.6.1.tgz", @@ -28715,6 +28867,26 @@ "lit-html": "^2.0.0" } }, + "@parse5/tools": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@parse5/tools/-/tools-0.3.0.tgz", + "integrity": "sha512-zxRyTHkqb7WQMV8kTNBKWb1BeOFUKXBXTBWuxg9H9hfvQB3IwP6Iw2U75Ia5eyRxPNltmY7E8YAlz6zWwUnjKg==", + "dev": true, + "requires": { + "parse5": "^7.0.0" + }, + "dependencies": { + "parse5": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", + "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "dev": true, + "requires": { + "entities": "^4.4.0" + } + } + } + }, "@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -32015,6 +32187,12 @@ "integrity": "sha512-j161Z9oiy8k74vchdrQGihfSp7QulrTclCUiPo0D7JF6/RjpXAmB0ThlTAFlSElkgqg0vdFgNAXaX9ZHZy25wQ==", "dev": true }, + "@xmldom/xmldom": { + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", + "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "dev": true + }, "@yarnpkg/core": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@yarnpkg/core/-/core-2.4.0.tgz", @@ -34562,6 +34740,12 @@ "once": "^1.4.0" } }, + "entities": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", + "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", + "dev": true + }, "envinfo": { "version": "7.10.0", "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.10.0.tgz", @@ -37892,6 +38076,12 @@ "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", "dev": true }, + "jsonschema": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/jsonschema/-/jsonschema-1.4.1.tgz", + "integrity": "sha512-S6cATIPVv1z0IlxdN+zUk5EPjkGCdnhN4wVSBlvoUO1tOLJootbo9CquNJmbIh4yikWHiUedhRYrNPn1arpEmQ==", + "dev": true + }, "JSONStream": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz", diff --git a/package.json b/package.json index 155020c8..b2901962 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,9 @@ "test:debug": "web-test-runner --coverage --watch --debug", "test:headless": "web-test-runner --coverage --watch --debug --headless", "generate-react-exports": "node scripts/generate-react-exports.js", - "generate-vue-types": "node scripts/generate-vue-types.js" + "generate-vue-types": "node scripts/generate-vue-types.js", + "localize:extract": "lit-localize extract", + "localize:build": "lit-localize build" }, "keywords": [ "web-components", @@ -66,6 +68,7 @@ "@floating-ui/dom": "^1.2.3", "@fontsource-variable/rubik": "^5.0.2", "@lit-labs/react": "^2.0.3", + "@lit/localize": "^0.12.1", "@open-wc/form-control": "^0.7.0", "@open-wc/form-helpers": "^0.2.2", "element-internals-polyfill": "^1.2.3", @@ -79,6 +82,7 @@ "@commitlint/config-conventional": "^16.2.4", "@commitlint/prompt-cli": "^16.2.4", "@custom-elements-manifest/analyzer": "^0.6.3", + "@lit/localize-tools": "^0.7.1", "@open-wc/testing": "^3.1.6", "@rollup/plugin-replace": "^4.0.0", "@storybook/addon-a11y": "7.4.3", diff --git a/playground/template.html b/playground/template.html index a65ba078..9deff5df 100644 --- a/playground/template.html +++ b/playground/template.html @@ -1,37 +1,59 @@ - -
- - -
- Copy this file as playground/index.html and try your work here by running
- npm run serve
.
-