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 @@ - - - - - Baklava Playground - - - - - - -

Baklava Playground

- -

- Copy this file as playground/index.html and try your work here by running - npm run serve. -

- - Baklava is ready - + }); + + + + + +

Baklava Playground

+ + + + Turkiye + The Netherlands + Germany + United Kingdom + + + + + + + + + diff --git a/scripts/build.js b/scripts/build.js index 96d9684c..bd13ba52 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -51,7 +51,9 @@ const args = parseArgs(process.argv.slice(2), { entryPoints: [ 'src/baklava.ts', 'src/baklava-react.ts', + 'src/localization.ts', ...(await globby([ + 'src/generated/**/*.ts', 'src/components/**/!(*.(test|d)).ts', 'src/themes/*.css', 'src/components/**/*.svg', diff --git a/src/baklava.ts b/src/baklava.ts index 43ab0fd7..c85ff00b 100644 --- a/src/baklava.ts +++ b/src/baklava.ts @@ -1,5 +1,6 @@ export { default as BlAlert } from "./components/alert/bl-alert"; export { default as BlBadge } from "./components/badge/bl-badge"; +export { default as BlLocale } from "./components/locale/bl-locale"; export { default as BlButton } from "./components/button/bl-button"; export { default as BlCheckboxGroup } from "./components/checkbox-group/bl-checkbox-group"; export { default as BlCheckbox } from "./components/checkbox-group/checkbox/bl-checkbox"; diff --git a/src/components/locale/bl-locale.ts b/src/components/locale/bl-locale.ts new file mode 100644 index 00000000..8252b6d7 --- /dev/null +++ b/src/components/locale/bl-locale.ts @@ -0,0 +1,40 @@ +import { LitElement, TemplateResult, html } from "lit"; +import { customElement } from "lit/decorators.js"; +import { allLocales } from "../../generated/locale-codes"; +import { getLocale, setLocale } from "../../localization"; +import "../select/bl-select"; +import { ISelectOption } from "../select/bl-select"; + +const localeNames = { + en: "English", + "tr-TR": "Türkçe", +}; + +// Note we use updateWhenLocaleChanges here so that we're always up to date with +// the active locale (the result of getLocale()) when the locale changes via a +// history navigation. +@customElement("bl-locale") +export default class BlLocale extends LitElement { + render(): TemplateResult { + return html` + + ${allLocales.map( + locale => + html` + ${localeNames[locale]} + ` + )} + + `; + } + + async localeChanged(event: CustomEvent) { + await setLocale(event.detail.value); + } +} + +declare global { + interface HTMLElementTagNameMap { + "bl-locale": BlLocale; + } +} diff --git a/src/components/pagination/bl-pagination.test.ts b/src/components/pagination/bl-pagination.test.ts index e886d971..a57122c3 100644 --- a/src/components/pagination/bl-pagination.test.ts +++ b/src/components/pagination/bl-pagination.test.ts @@ -39,8 +39,6 @@ describe("bl-pagination", () => { expect(el.itemsPerPage).to.equal(10); expect(el.hasJumper).to.equal(false); expect(el.hasSelect).to.equal(false); - expect(el.jumperLabel).to.equal("Go To"); - expect(el.selectLabel).to.equal("Show"); }); it("should correctly set the attributes", async () => { diff --git a/src/components/pagination/bl-pagination.ts b/src/components/pagination/bl-pagination.ts index a5bafaa4..1cee4658 100644 --- a/src/components/pagination/bl-pagination.ts +++ b/src/components/pagination/bl-pagination.ts @@ -1,6 +1,7 @@ import { CSSResultGroup, html, LitElement, TemplateResult, PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators.js"; import { ifDefined } from "lit/directives/if-defined.js"; +import { localized, msg } from "@lit/localize"; import { event, EventDispatcher } from "../../utilities/event"; import "../button/bl-button"; import "../input/bl-input"; @@ -13,6 +14,7 @@ import style from "./bl-pagination.css"; */ @customElement("bl-pagination") +@localized() export default class BlPagination extends LitElement { static get styles(): CSSResultGroup { return [style]; @@ -46,7 +48,7 @@ export default class BlPagination extends LitElement { * Sets the jumper label */ @property({ attribute: "jumper-label", type: String }) - jumperLabel = "Go To"; + jumperLabel?: string; /** * Adds select element to choose the items per page @@ -58,7 +60,7 @@ export default class BlPagination extends LitElement { * Adds select element to choose the items per page */ @property({ attribute: "select-label", type: String }) - selectLabel = "Show"; + selectLabel?: string; /** * Sets the items per page options of the select element @@ -235,10 +237,13 @@ export default class BlPagination extends LitElement { } render(): TemplateResult { + const jumperText = this.jumperLabel ?? msg("Go to", { desc: "bl-pagination: jumper text" }); + const selectText = this.selectLabel ?? msg("Show", { desc: "bl-pagination: listing text" }); + const selectEl = this.hasSelect ? html`
- + ${this.itemsPerPageOptions.map(option => { return html` - +
` : null; diff --git a/src/components/select/bl-select.ts b/src/components/select/bl-select.ts index 62102e57..85c19945 100644 --- a/src/components/select/bl-select.ts +++ b/src/components/select/bl-select.ts @@ -3,6 +3,7 @@ import { customElement, property, query, queryAll, state } from "lit/decorators. import { classMap } from "lit/directives/class-map.js"; import { ifDefined } from "lit/directives/if-defined.js"; import { autoUpdate, computePosition, flip, MiddlewareState, offset, size } from "@floating-ui/dom"; +import { msg, localized } from "@lit/localize"; import { FormControlMixin, requiredValidator } from "@open-wc/form-control"; import { FormValue } from "@open-wc/form-helpers"; import "element-internals-polyfill"; @@ -31,6 +32,7 @@ export type CleanUpFunction = () => void; * @cssproperty [--bl-popover-position=fixed] Sets the positioning strategy of select popover. You can set it as `absolute` if you need to show popover relative to its trigger element. */ @customElement("bl-select") +@localized() export default class BlSelect extends FormControlMixin( LitElement ) { @@ -155,7 +157,7 @@ export default class BlSelect extends Form * Sets select all text in multiple select */ @property({ type: String, attribute: "select-all-text" }) - selectAllText = "Select All"; + selectAllText?: string; /** * Enable search functionality for the options within the list @@ -183,13 +185,13 @@ export default class BlSelect extends Form * Text to display when no search results are found. */ @property({ type: String, attribute: "search-not-found-text", reflect: true }) - searchNotFoundText = "No Data Found"; + searchNotFoundText?: string; /** * Text to display on the clear search button. */ @property({ type: String, attribute: "popover-clear-search-text", reflect: true }) - popoverClearSearchText = "Clear Search"; + popoverClearSearchText?: string; /* Declare internal reactive properties */ @state() @@ -387,6 +389,9 @@ export default class BlSelect extends Form const isDividerShown = isSearchBarVisible || isMultipleWithSelection; + const searchbarPlaceholderText = + this.searchBarPlaceholder ?? msg("Search", { desc: "bl-select: search placeholder text" }); + const searchMagIcon = html` extends Form : html` @@ -477,7 +482,10 @@ export default class BlSelect extends Form const isAllRenderedOptionsSelected = this._connectedOptions .filter(option => !option.hidden) .every(option => option.selected); + const isAnySelected = this._selectedOptions.filter(option => !option.hidden).length > 0; + const selectAllText = + this.selectAllText ?? msg("Select All", { desc: "bl-select: select all text" }); return html` extends Form aria-selected="${isAllRenderedOptionsSelected}" @bl-checkbox-change="${this._handleSelectAll}" > - ${this.selectAllText} + ${selectAllText} `; } @@ -502,6 +510,13 @@ export default class BlSelect extends Form const label = this.label ? html`` : ""; + const noDataText = + this.searchNotFoundText ?? msg("No Data Found", { desc: "bl-select: search no data text" }); + + const clearSearchText = + this.popoverClearSearchText ?? + msg("Clear Search", { desc: "bl-select: clear search button text" }); + return html`
extends Form ${this.searchBar && this.noResultFound ? html`
- ${this.searchNotFoundText} + ${noDataText} { @@ -533,7 +548,7 @@ export default class BlSelect extends Form target: HTMLInputElement; }); }} - >${this.popoverClearSearchText}${clearSearchText}
` : ""} diff --git a/src/generated/locale-codes.ts b/src/generated/locale-codes.ts new file mode 100644 index 00000000..6299cf23 --- /dev/null +++ b/src/generated/locale-codes.ts @@ -0,0 +1,23 @@ +// Do not modify this file by hand! +// Re-generate this file by running lit-localize. + +/** + * The locale code that templates in this source code are written in. + */ +export const sourceLocale = `en`; + +/** + * The other locale codes that this application is localized into. Sorted + * lexicographically. + */ +export const targetLocales = [ + `tr-TR`, +] as const; + +/** + * All valid project locale codes. Sorted lexicographically. + */ +export const allLocales = [ + `en`, + `tr-TR`, +] as const; diff --git a/src/generated/locales/tr-TR.ts b/src/generated/locales/tr-TR.ts new file mode 100644 index 00000000..750fcb61 --- /dev/null +++ b/src/generated/locales/tr-TR.ts @@ -0,0 +1,19 @@ + + // Do not modify this file by hand! + // Re-generate this file by running lit-localize + + + + + /* eslint-disable no-irregular-whitespace */ + /* eslint-disable @typescript-eslint/no-explicit-any */ + + export const templates = { + 's144508ac0e146c46': `Hiçbir Sonuç Bulunamadı`, +'s5d929ff1619ac0c9': `Arama`, +'s716a6024e3fe999c': `Göster`, +'s76ddb3a843ed8e06': `Aramayı Temizle`, +'sb1ba2131b9a7c7b0': `Git`, +'sbaace8219b5f4612': `Tümünü Seç`, + }; + \ No newline at end of file diff --git a/src/localization.ts b/src/localization.ts new file mode 100644 index 00000000..15ba2a1b --- /dev/null +++ b/src/localization.ts @@ -0,0 +1,11 @@ +import { LocaleModule, configureLocalization } from "@lit/localize"; +import { sourceLocale, targetLocales } from "./generated/locale-codes"; +import * as templates_TR from "./generated/locales/tr-TR"; + +const localizedTemplates = new Map([["tr-TR", templates_TR]]); + +export const { getLocale, setLocale } = configureLocalization({ + sourceLocale, + targetLocales, + loadLocale: async (locale: string) => localizedTemplates.get(locale) as LocaleModule, +}); diff --git a/translations/tr-TR.xlf b/translations/tr-TR.xlf new file mode 100644 index 00000000..714d8327 --- /dev/null +++ b/translations/tr-TR.xlf @@ -0,0 +1,37 @@ + + + + + + Search + Arama + bl-select: search placeholder text + + + Select All + Tümünü Seç + bl-select: select all text + + + No Data Found + Hiçbir Sonuç Bulunamadı + bl-select: search no data text + + + Clear Search + Aramayı Temizle + bl-select: clear search button text + + + Go to + Git + bl-pagination: jumper text + + + Show + Göster + bl-pagination: listing text + + + +