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

[regression] Custom translation not working when using a single non-root locale on MacOS #1849

Closed
1 task
Fryuni opened this issue May 10, 2024 · 5 comments
Closed
1 task
Labels
🐛 bug Something isn't working

Comments

@Fryuni
Copy link
Member

Fryuni commented May 10, 2024

What version of starlight are you using?

main

What version of astro are you using?

4.8.2

What package manager are you using?

pnpm

What operating system are you using?

Mac

What browser are you using?

N/A

Describe the Bug

Custom translations are not being applied when using a single non-root locale on MacOS. Calls to useTranslation result in the default translations being used.

Link to Minimal Reproducible Example

describe('useTranslations()', () => {
test('works when no i18n collection is available', () => {
const t = useTranslations('fr');
expect(t).toBeTypeOf('function');
expect(t('page.editLink')).toBe(translations.fr?.['page.editLink']);
});
test('returns default locale for unknown language', () => {
const locale = 'xx';
expect(translations).not.toHaveProperty(locale);
const t = useTranslations(locale);
expect(t('page.editLink')).toBe(translations.fr?.['page.editLink']);
});

Participation

  • I am willing to submit a pull request for this issue.
@Fryuni Fryuni added the 🐛 bug Something isn't working label May 10, 2024
@Fryuni
Copy link
Member Author

Fryuni commented May 10, 2024

I can send a PR, just don't have time to investigate this in the near future. If someone else wants to do it before me, be my guest :)

@delucis
Copy link
Member

delucis commented May 20, 2024

Coming back to this @Fryuni, did you say you also tested on other operating systems? And this is macOS-specific?

I’m not sure I follow how the test you linked to reproduces this — it’s passing for me? Or are you saying the test is wrong?

@HiDeoo
Copy link
Member

HiDeoo commented May 20, 2024

To add a bit more context, I tried to repro on Discord but did not manage to hit the same issue on macOS:

repro

@Fryuni
Copy link
Member Author

Fryuni commented May 20, 2024

Tried to run again and it is no longer breaking. Went back to what I was doing in another branch and it failed there. Switching to main again continues to fail, so it seems just pnpm is getting confused with the install from both branches.

Cleaning the repo before installing dependencies makes it work.

Sorry guys, false alarm. Weird that it only happens on Mac tho

@Fryuni Fryuni closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
@delucis
Copy link
Member

delucis commented May 20, 2024

Oh, cool! Well, thanks for checking again.

Fingers crossed this macghOSt doesn’t come back 👻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants