Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(docs): make actual documentation #4

Merged
merged 1 commit into from
Oct 5, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
@@ -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.