Giter VIP home page Giter VIP logo

langua's Issues

[Feature request] Make the `translate` function types definition stricter

Is your feature request related to a problem? Please describe.
The translate function is loosely typed. The usage is unclear most of the time. This behaviour produces the following wrong usage:

const i18n = langua({ en: { foo: 'Hello, world!'  }, 'en')

i18n.translate({ id: 'foo', values: { 'unknown-value': 'bar' } }) // Having the translation values here means do a no-op uselessy. 

Describe the solution you'd like
Explicitly requiring the types of the values when a translation must take some values to be correctly interpolated would force a conscious use.

Describe alternatives you've considered
Treat the translation associated with a translation id as a string literal. This characteristic would permit the extraction of the translation values automatically. This is an alternative to be explored.

Additional context
None.

Configure Kodiak

Problem

Most of the time, having to go through trivial Pull Requests (e.g., Dependabot's PRs that add minor and patch versions) wastes maintainers' time.

Solution

Adopting Kodiak would alleviate this problem. The auto-merge feature it offers could reduce the friction that maintainers have during the maintenance of this repository. In this light, for example, only major versions could require a deep analysis done by maintainers.

[Feature request] Add React adapter

Is your feature request related to a problem? Please describe.
Currently, Langua offers only a simple integration that does not fit React.

Describe the solution you'd like
A new library called @langua/react.

A context LanguaProvider to share the current translation status to the React tree. We use LanguaProvider to clarify that this provider belongs to the scope @langua.

A hook useTranslation that, given a key and some values, returns the related interpolated translation.

A hook useLangua that permits access to the Langua's primitives (e.g., setLocale, translate, etc.).

A component Translation that, given a key and some values, returns the related interpolated translation.

A High Order Component withLangua that acts as useLangua.

Describe alternatives you've considered
https://react.i18next.com/

Additional context
None.

Add Issues templates to better handle contributions

Problem

As of now, this repository does not have Issues templates. This situation means that contributors would not follow a precise standard when opening feature requests or bug tickets, making the maintainers' lives harder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.