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

Problems with LIB check in cli extractor #233

Open
mojoaxel opened this issue Oct 1, 2023 · 1 comment
Open

Problems with LIB check in cli extractor #233

mojoaxel opened this issue Oct 1, 2023 · 1 comment

Comments

@mojoaxel
Copy link

mojoaxel commented Oct 1, 2023

Is your feature request related to a problem? Please describe.

The cli extractor checks if the format method was imported from the hard-coded string 'svelte-i18n'.

This can cause multiple problems. In these cases the extractor does not work:

  1. If someone uses a forked, scoped package (e.g. @fullstax/svelte-i18n).
  2. If a project wants to import the format function not from 'svelte-i18n' directly but from a wrapper lib
    (e.g. import { _ } from '../helpers/i18n), maybe to hide the i18n implementation detail.
  3. If someone wants to use the extractor together with a compatible lib like svelte-intl-precompile.

Describe the solution you'd like

I propose to introduce a new cli parameter unsave to disable the library-check altogether.
This could look like this: svelte-i18n extract --unsave .

Describe alternatives you've considered

It would be possible to not use the hard coded lib-name but instead get the lib-name from the package.json. This would solve problem 1 but not 2 and 3.

It also would be possible to introduce a cli parameter to provide the lib-name directly.
e.g. svelte-i18n extract --lib-name "svelte-intl-precompile" .
This would solve problem 1 and 3 but not 2.

How important is this feature to you?

I'll provide a fix for this shortly. If this will not get merged within a few days I'll release my own fork.

mojoaxel added a commit to fllstx/svelte-i18n that referenced this issue Oct 1, 2023
mojoaxel added a commit to fllstx/svelte-i18n that referenced this issue Oct 1, 2023
mojoaxel added a commit to fllstx/svelte-i18n that referenced this issue Oct 1, 2023
@mojoaxel
Copy link
Author

mojoaxel commented Oct 1, 2023

I've created a pull-request to implement this: #234

mojoaxel added a commit to fllstx/svelte-i18n that referenced this issue Sep 4, 2024
mojoaxel added a commit to fllstx/svelte-i18n that referenced this issue Sep 4, 2024
mojoaxel added a commit to fllstx/svelte-i18n that referenced this issue Sep 4, 2024
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

No branches or pull requests

1 participant