Skip to content

Commit

Permalink
fix(docs): make actual documentation
Browse files Browse the repository at this point in the history
closes #3
closes #1
  • Loading branch information
TobiTenno committed Oct 5, 2021
1 parent 7a28d50 commit 482e01b
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 141 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ node_modules
# WebStorm files
.idea
types/

# Some other generated files
package.json.backup
51 changes: 50 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,53 @@ desiring to stay as current as possible in addition to maintaining maximum cover

## Usage

TODO
There are 2 parameters:
- map of locales w/ string,string objects.
- locale you want to use right now

What this lets you do is feed in all of the values you use, maybe from a shareable json, shared config, or some sort of dynamically imported list.

Some things we support:
- Template replacement for dynamic labels
- Strings or Numbers being replaced
- Allows you to still "i18n" strings that aren't yet added to your list

Some goals:
- Staying as small as possible. I want to do this with no extraneous (or ideally no at all) dependencies.
- Keeping your experience consistent. As part of this, I leverage [semantic-release](https://github.com/semantic-release/semantic-release)
-

Some things I want to add:
- adding a warning.json or some sort of shareable output for strings that have been run through the system that haven't been translated
- Even more coverage
- Anything the community needs to make your i18n experience easier!

Some examples are in the `src/test/i18n.spec.js` file.

Example:
```js
import use from 'i18n-string-templates';

const locales = {
en: {
sample: 'sample',
'{0} debates {1}': '{}
}
};
const i18n = use(locales, 'en');
console.log(i18n`sample`); // outputs: sample
console.log(i18n`${'joe'} debates ${'tom'}`); // outputs joe debates tom
console.log(i18n``)
```
## Requirements
- Node 14+
- You're using a Pure ESM package. You cannot `require()` this package.

## Super awesome badges

[![Actions](https://github.com/TobiTenno/i18n-string-templates/actions/workflows/ci.yaml/badge.svg)](https://github.com/TobiTenno/i18n-string-templates/actions/workflows/ci.yaml)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Coverage Status](https://coveralls.io/repos/github/TobiTenno/i18n-string-templates/badge.svg?branch=main)](https://coveralls.io/github/TobiTenno/i18n-string-templates?branch=main)
140 changes: 0 additions & 140 deletions package.json.backup

This file was deleted.

0 comments on commit 482e01b

Please sign in to comment.