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

Feature request: A property to set the asset path #129

Closed
keygun-development opened this issue Feb 25, 2023 · 4 comments
Closed

Feature request: A property to set the asset path #129

keygun-development opened this issue Feb 25, 2023 · 4 comments
Labels
bug Something isn't working released on @beta

Comments

@keygun-development
Copy link

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

When generating translations the source path to a file won't change and I'll have to change it manually.
For example:
<script src="../path/to/file"></script>

Won't result in:
<script src="../../path/to/file"></script>

But remains the same. Therefore I'll have to manually change the path or I need to define the path inside the translations.

Describe the solution you'd like

I would like to see a property in the astro-i18next.config to set the path to the asset folder.
Then when translating it would resolve the path by this property.

Here is an example of what it would look like:

/** @type {import('astro-i18next').AstroI18nextConfig} */
export default {
    assetPath: "src/assets/"
};

<script src={(assetPath("/js/index.js"))}></script>

Describe alternatives you've considered

An alternative would be to set the asset folder path in the translation file.

@yassinedoghri yassinedoghri added the bug Something isn't working label Mar 5, 2023
yassinedoghri pushed a commit that referenced this issue Mar 5, 2023
# [1.0.0-beta.19](v1.0.0-beta.18...v1.0.0-beta.19) (2023-03-05)

### Bug Fixes

* add levels to relative path in script tag ([1203d42](1203d42)), closes [#129](#129)
* use unjs/pathe to resolve generated localized files paths across OS ([da80a8d](da80a8d)), closes [#135](#135)

### Reverts

* **i18next-peer:** reset i18next as package dependency ([7906e19](7906e19)), closes [#131](#131)
@github-actions
Copy link

github-actions bot commented Mar 5, 2023

🎉 This issue has been resolved in version 1.0.0-beta.19 🎉

The release is available on:

Your semantic-release bot 📦🚀

@flaviotoribio
Copy link

I noticed it still doesn't work after 1.0.0-beta.19, so I took a look at this commit (1203d42) and it looks like a small "typo". Instead of <script src=, it's using <src in the RegEx.

Can you fix this @yassinedoghri?

Thanks for your work!

@yassinedoghri
Copy link
Owner

@flaviotoribio Good catch, I'll fix it.

yassinedoghri pushed a commit that referenced this issue Mar 9, 2023
# [1.0.0-beta.20](v1.0.0-beta.19...v1.0.0-beta.20) (2023-03-09)

### Bug Fixes

* add missing `script` to regex in resolveRelativePathsLevel ([9288efe](9288efe)), closes [#129](#129)
* get astro pages' full paths using fdir's withFullPaths instead of withRelativePaths ([92a5178](92a5178)), closes [#135](#135)

### Features

* make base path for i18next resources configurable ([4e4b057](4e4b057))
@github-actions
Copy link

github-actions bot commented Mar 9, 2023

🎉 This issue has been resolved in version 1.0.0-beta.20 🎉

The release is available on:

Your semantic-release bot 📦🚀

AliLee0923 pushed a commit to AliLee0923/astro-i18N that referenced this issue Dec 2, 2023
# [1.0.0-beta.19](yassinedoghri/astro-i18next@v1.0.0-beta.18...v1.0.0-beta.19) (2023-03-05)

### Bug Fixes

* add levels to relative path in script tag ([1203d42](yassinedoghri/astro-i18next@1203d42)), closes [#129](yassinedoghri/astro-i18next#129)
* use unjs/pathe to resolve generated localized files paths across OS ([da80a8d](yassinedoghri/astro-i18next@da80a8d)), closes [#135](yassinedoghri/astro-i18next#135)

### Reverts

* **i18next-peer:** reset i18next as package dependency ([7906e19](yassinedoghri/astro-i18next@7906e19)), closes [#131](yassinedoghri/astro-i18next#131)
AliLee0923 pushed a commit to AliLee0923/astro-i18N that referenced this issue Dec 2, 2023
# [1.0.0-beta.20](yassinedoghri/astro-i18next@v1.0.0-beta.19...v1.0.0-beta.20) (2023-03-09)

### Bug Fixes

* add missing `script` to regex in resolveRelativePathsLevel ([9288efe](yassinedoghri/astro-i18next@9288efe)), closes [#129](yassinedoghri/astro-i18next#129)
* get astro pages' full paths using fdir's withFullPaths instead of withRelativePaths ([92a5178](yassinedoghri/astro-i18next@92a5178)), closes [#135](yassinedoghri/astro-i18next#135)

### Features

* make base path for i18next resources configurable ([4e4b057](yassinedoghri/astro-i18next@4e4b057))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released on @beta
Projects
None yet
Development

No branches or pull requests

3 participants