update tsconfig
This commit is contained in:
parent
dd28b52d72
commit
e8cae9f23e
@ -5,17 +5,29 @@
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smarti18n",
|
||||
"description": "a package dealing with i18n stuff",
|
||||
"description": "A package for internationalization (i18n) that provides utilities for dealing with international phone number prefixes, country codes, and names.",
|
||||
"npmPackagename": "@push.rocks/smarti18n",
|
||||
"license": "MIT",
|
||||
"projectDomain": "push.rocks"
|
||||
"projectDomain": "push.rocks",
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"internationalization",
|
||||
"country codes",
|
||||
"phone prefixes",
|
||||
"typescript",
|
||||
"npm package",
|
||||
"country names",
|
||||
"language support",
|
||||
"translation utilities",
|
||||
"globalization"
|
||||
]
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"tsdocs": {
|
||||
"tsdoc": {
|
||||
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
|
||||
}
|
||||
}
|
16
package.json
16
package.json
@ -2,7 +2,7 @@
|
||||
"name": "@push.rocks/smarti18n",
|
||||
"version": "1.0.4",
|
||||
"private": false,
|
||||
"description": "a package dealing with i18n stuff",
|
||||
"description": "A package for internationalization (i18n) that provides utilities for dealing with international phone number prefixes, country codes, and names.",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
@ -43,5 +43,17 @@
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
],
|
||||
"keywords": [
|
||||
"i18n",
|
||||
"internationalization",
|
||||
"country codes",
|
||||
"phone prefixes",
|
||||
"typescript",
|
||||
"npm package",
|
||||
"country names",
|
||||
"language support",
|
||||
"translation utilities",
|
||||
"globalization"
|
||||
]
|
||||
}
|
||||
}
|
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@ -0,0 +1 @@
|
||||
|
123
readme.md
123
readme.md
@ -1,31 +1,108 @@
|
||||
# @push.rocks/smarti18n
|
||||
a package dealing with i18n stuff
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smarti18n)
|
||||
* [gitlab.com (source)](https://gitlab.com/push.rocks/smarti18n)
|
||||
* [github.com (source mirror)](https://github.com/push.rocks/smarti18n)
|
||||
* [docs (typedoc)](https://push.rocks.gitlab.io/smarti18n/)
|
||||
## Install
|
||||
To use @push.rocks/smarti18n in your project, you will need to install it via npm or yarn. Ensure you have Node.js installed before proceeding. To install the package, run the following command in your project's root directory:
|
||||
|
||||
## Status for master
|
||||
```bash
|
||||
npm install @push.rocks/smarti18n --save
|
||||
```
|
||||
or if you prefer using yarn:
|
||||
|
||||
Status Category | Status Badge
|
||||
-- | --
|
||||
GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smarti18n/badges/master/pipeline.svg)](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smarti18n/badges/master/coverage.svg)](https://lossless.cloud)
|
||||
npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smarti18n)](https://lossless.cloud)
|
||||
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smarti18n)](https://lossless.cloud)
|
||||
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
|
||||
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smarti18n)](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smarti18n)](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smarti18n)](https://lossless.cloud)
|
||||
```bash
|
||||
yarn add @push.rocks/smarti18n
|
||||
```
|
||||
|
||||
This command will download @push.rocks/smarti18n and add it to your project's `node_modules` directory as well as add it as a dependency in your project's `package.json` file.
|
||||
|
||||
## Usage
|
||||
Use TypeScript for best in class intellisense
|
||||
For further information read the linked docs at the top of this readme.
|
||||
The `@push.rocks/smarti18n` package provides functionalities to deal with internationalization (i18n) aspects, such as language codes, country codes, and potentially localized strings management. Let's explore its capabilities through various use cases.
|
||||
|
||||
## Legal
|
||||
> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
### Importing the module
|
||||
|
||||
First, you need to import the module into your TypeScript project. Since this package uses ESM syntax, you should import it like so:
|
||||
|
||||
```typescript
|
||||
import * as smarti18n from '@push.rocks/smarti18n';
|
||||
```
|
||||
|
||||
Or if you just need specific exports like `countryCodeArray`, you can import them directly:
|
||||
|
||||
```typescript
|
||||
import { countryCodeArray } from '@push.rocks/smarti18n';
|
||||
```
|
||||
|
||||
### Working with Country Codes
|
||||
|
||||
One primary feature of `@push.rocks/smarti18n` is dealing with country codes. The module provides an array of country codes along with their respective names and phone prefixes.
|
||||
|
||||
```typescript
|
||||
import { countryCodeArray } from '@push.rocks/smarti18n';
|
||||
|
||||
// Let's log the name and phone prefix of Germany
|
||||
const germanyInfo = countryCodeArray.find(country => country.code === 'DE');
|
||||
console.log(`Country: ${germanyInfo?.name}, Phone Prefix: ${germanyInfo?.phonePrefix}`);
|
||||
```
|
||||
|
||||
This example would output something like:
|
||||
|
||||
```plaintext
|
||||
Country: Germany, Phone Prefix: 49
|
||||
```
|
||||
|
||||
This simple scenario showcases how you can retrieve information about a country, which can be particularly useful when working with international forms, user profiles, etc.
|
||||
|
||||
### Advanced Usage Scenarios
|
||||
|
||||
Though the provided test cases and examples primarily deal with country codes, the infrastructure of `@push.rocks/smarti18n` allows for expansions to include handling localized strings based on user locale, formatting numbers and dates according to locale, etc.
|
||||
|
||||
Here's a conceptual overview of how you might expand upon the existing framework to include localized strings:
|
||||
|
||||
1. **Defining Localized Strings**: Imagine you have JSON files for each locale, containing key-value pairs of strings that need to be localized.
|
||||
|
||||
```json
|
||||
// en.json
|
||||
{
|
||||
"greeting": "Hello, World!"
|
||||
}
|
||||
|
||||
// de.json
|
||||
{
|
||||
"greeting": "Hallo, Welt!"
|
||||
}
|
||||
```
|
||||
|
||||
2. **Loading and Using Localized Strings**: First, you'd load the appropriate JSON file based on the user's locale. Then, you could access the localized strings using a key.
|
||||
|
||||
```typescript
|
||||
import { getLocalizedString } from '@push.rocks/smarti18n';
|
||||
|
||||
const userLocale = 'de'; // This would typically come from the user's preferences
|
||||
const greeting = getLocalizedString('greeting', userLocale);
|
||||
console.log(greeting); // Outputs: Hallo, Welt!
|
||||
```
|
||||
|
||||
Note: The function `getLocalizedString` is hypothetical and represents a potential feature of the library, illustrating how it could be expanded to handle a broader scope of i18n needs.
|
||||
|
||||
### Conclusion
|
||||
|
||||
While `@push.rocks/smarti18n` currently focuses on providing a comprehensive listing of country codes, its design allows for easy expansion to cover a wide array of internationalization and localization features. Whether you're building a multinational web application or just need to handle different languages and regions, `@push.rocks/smarti18n` offers a solid foundation to incorporate i18n aspects into your TypeScript projects.
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
||||
|
||||
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
||||
|
||||
### Trademarks
|
||||
|
||||
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
||||
|
||||
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
||||
|
Loading…
Reference in New Issue
Block a user