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

Namespaces are not handled #18

Open
JesperSporronRocker opened this issue May 27, 2022 · 7 comments
Open

Namespaces are not handled #18

JesperSporronRocker opened this issue May 27, 2022 · 7 comments

Comments

@JesperSporronRocker
Copy link

I have translations that are namespaced, i.e.

const { t } = useTranslation(["shared", "thisFeature"]);
const errorTitle = t("shared:error.defaultTitle");
const pageTitle = t("thisFeature:title");

However i18n-unused does not account for these namespaces, and is showing me that:*

  • shared:error.defaultTitle is missing a translation (when running display-missed).
  • error.defaultTitle is unused (when running display-unused).

I found an ugly fix where display-unused ignores all files that were posted in display-missed, but I can't use that with remove-unused (unless I update the config json). Adding an option to natively support this would be nice :)

@mxmvshnvsk
Copy link
Owner

Hi, I see your point. I'll look docs about this option and make update at next week. Thx for interest.

@adriandmitroca
Copy link

I believe the same situation applies to key prefixes, such as:

const { t } = useTranslation("users", { keyPrefix: "index" })

@medihack
Copy link
Contributor

medihack commented Aug 20, 2022

Unfortunately, I have the same problem of missing namespace support. And as namespaces can be configured in so many ways (even when generating the i18next instance itself), I guess this problem can't be solved perfectly. My suggestion would be to introduce a setting to be more lax. So if a key is not found in any of the locale files, then it is reported as missed. At least this is a hint then that there is something wrong. How about a PR? ;-)

@mxmvshnvsk
Copy link
Owner

mxmvshnvsk commented Aug 20, 2022

@medihack I'm always for new PR's to the repository =)

@boredland
Copy link

Hi, I see your point. I'll look docs about this option and make update at next week. Thx for interest.

Hi there! Did you ever have a chance to look into it?

@mxmvshnvsk
Copy link
Owner

@boredland I hope, that yeah. But without date, maybe this weekends.

@lurenzsgp
Copy link

Hi there! I'm also interested in that issue. Do we have any advancement?

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

6 participants