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 auto-import #380

Merged
merged 2 commits into from
Dec 6, 2020
Merged

Fix auto-import #380

merged 2 commits into from
Dec 6, 2020

Conversation

aralroca
Copy link
Owner

@aralroca aralroca commented Dec 6, 2020

@aralroca aralroca merged commit 04c2ea5 into canary Dec 6, 2020
@aralroca aralroca deleted the fix-package branch December 6, 2020 12:57
@aralroca aralroca changed the title Fix package Fix auto-import Dec 6, 2020
@aralroca aralroca added this to the 1.0.0 milestone Dec 6, 2020
aralroca added a commit that referenced this pull request Dec 9, 2020
* Fix plurals (#347)

* Add plurals: zero, one, two, few, many, other

* Update node support

* Update node support

* Update node support

* Fix withTranslation type (#354)

* Replace CLI to next plugin + move project to typescript + refactor (#359)

* [WIP] Implement webpack loader

* Update .gitignore

* Implement loader when the _app.js has a getInitialProps

* Add missing pages on example

* Remove builder tests right now

* Fix default loadLocaleFrom on _app.js

* Implement src/_loader/hasGetInitialPropsOnAppJs.js

* add I18nProvider on top of _app.js if _app.js exist

* Load default app.js with I18nProvider

* Remove all deprecations from 0.19

* Implement loading namespaces from getInitialProps on pages

* Refactor

* Refactor loader

* Add tests + improve templateWithHoc

* Update dependences

* Implement basic template with loader

* Fix case of getServerSideProps

* Fix no export default

* Add loadNamespaces + refactor + add snapshots

* Add test cases + fix cases for getStaticProps and getServerSideProps

* Add more test cases + fix more cases about global exports

* Fix appWithI18n

* Update .npmignore

* [WIP] migrate to TypeScript

* Fix loader

* Apply fixes on index.js

* Fix tests

* add experimental version

* Implement logBuild

* Update package version to 1.0.0-experimental.6

* Add esModuleInterop=true

* Update tsconfig.json

* Add warnings

* Do dynamic prop from DynamicNamespace transparent

* Implement fallbacks (#333)

* Add fallback typescript type (#334)

* Add fallback typescript type

* Update index.d.ts

* Update index.d.ts

* Implement default namespace on useTranslation hook (#335)

* Improve type

* Fix Trans type

* Update dependencies

* Support components trans as object (#336)

* Support Trans 'components' property to be an object

* Fix docs

* Fix when _app.js is missing

* Change way to load webpack loader

* Modify todo list

* Remove next/app from appWithI18n + refactor

* Update docs

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update plurals docs

* Add migration guide `0.x` to `1.0.0` (#349)

* Add migration guide `0.x` to `1.0.0`

* Fix plural section

* Add yarn command

* docs: add dislick as a contributor (#350)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

* Improve docs

* Update README.md

* Fix src/pages in experimiental 1.0 (#352)

* Update examples + some fixes

* Improve example

* Improve examples

* Add warning about getInitialProps on pages

* add notes about appWithI18n on the migration guide

* Add useful links to the migration guide

* Fix imports from webpack loader in windows (#355)

* Fix imports from webpack loader in windows

* Fix clean helper on tests

* Fix clean helper on tests

* Fix comma

* Fix test

* Use webpack alias for absolute imports

* Move plugin files to typescript

* Update package version

Co-authored-by: Patrick <[email protected]>
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>

* Update README with the new examples (#360)

* Update README with the new examples

* Add quotes

* fix: compiled page pathname in windows (#362)

* fix: compiled page name in windows

* Update src/plugin/loader.ts

Co-authored-by: Aral Roca Gomez <[email protected]>

Co-authored-by: Aral Roca Gomez <[email protected]>

* docs: add vimutti77 as a contributor (#363)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Aral Roca Gomez <[email protected]>

* Update package version

* Change config way i18provider (#369)

* Change way to use i18n config inside I18nProvider

* Add default

* Merge nested configs in nester I18nProviders (#370)

* Fix _app.js with class extended from NextApp (#371)

* Update CONTRIBUTING.md

* Clean build plugin packages (#372)

* Add support to customize the interpolation delimeter (#373)

* Add support for nesting translations (#368)

* Add support for nesting translations

* Add a nested version of translations example

* Add support for numbers in the nested keys

* docs: add josephfarina as a contributor (#374)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Aral Roca Gomez <[email protected]>

* Update README.md

* Update README.md

* Update package version

* Update README

* Update README.md

* Update README.md

* Update example adding custom interpolation (#375)

* Re-add Translate type (#376)

* Improve interface Translate (#377)

The interface "Translate" describes the "translate" function in three variants.

In the following the variants of the return values of the function are considered.

1. the return value corresponds to a string or an object (of any complexity) - string | object

In the case of an object, the return type (string | object) requires a type cast from the function's user

Example 1
const translatedObject: TypeOfTranslatedObject = t(
translationKey,
    {},
    {returnObjects: true}
);

example 2
const translatedObject = t(
    translationKey,
    {},
    {returnObjects: true}
) as TypeOfTranslatedObject;

To make the use of the function more intuitive, the object type of the object to be translated is passed to the function call as generic type parameter.

Example 1 - Return of a simple object of the type TypeOfTranslatedObject

const translatedObject = t<TypeOfTranslatedObject>(
    translationKey,
    {},
    {returnObjects: true}
);

Example 2 - Return of an array whose contents correspond to the object type TypeOfTranslatedObject

const translatedObject = t<Array<TypeOfTranslatedObject>>(
    translationKey,
    {},
    {returnObjects: true}
);

The change made in the commit,
- introduces a generic type parameter and its initialization to a string,
- the type parameter is optional. If no type parameter is specified by the caller, the default value string is used.

The return value of the second and third variant corresponds to a string only and no other type.

The change made in the commit
- removes the generic type declaration, there is only one return type,
- an override from outside is not possible.

Co-authored-by: gurkerl83 <[email protected]>

* docs: add gurkerl83 as a contributor (#378)

* docs: update README.md [skip ci]

* docs: update .all-contributorsrc [skip ci]

Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Aral Roca Gomez <[email protected]>

* Add bundle analyzer to the complex example (#379)

* Fix package (#380)

* Fix package

* Move types to the root

* Add (getT) to get the t function outside components / pages (#383)

* Support to consume t function outside React

* fix typo

* Fix issue with Node 10 (#386)

* Update README.md

* Update package version

Co-authored-by: Patrick <[email protected]>
Co-authored-by: allcontributors[bot] <46447321+allcontributors[bot]@users.noreply.github.com>
Co-authored-by: Vantroy <[email protected]>
Co-authored-by: Joey <[email protected]>
Co-authored-by: gurkerl83 <[email protected]>
Co-authored-by: gurkerl83 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant