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

Access to Messages and Terms from a FluentBundle #3

Open
NoahTheDuke opened this issue Mar 13, 2025 · 2 comments
Open

Access to Messages and Terms from a FluentBundle #3

NoahTheDuke opened this issue Mar 13, 2025 · 2 comments

Comments

@NoahTheDuke
Copy link

Hey there!

This is a great library, thanks for writing it. I'm building a cli tool to compare all of my fluent files, seeing where I'm missing translations or have misspellings. To do that, it would be really helpful to have access to the added terms and messages in the FluentBundle. Currently, I can get the message or term if I know the id, but it would be great to have getAllMessages and getAllTerms methods.

/**
* Returns the Message for the given id
*/
public Optional<Message> getMessage(@NotNull final String id) {
return Optional.ofNullable( messages.get( id ) );
}
/**
* Returns the Term for the given id
*/
public Optional<Term> getTerm(@NotNull final String id) {
return Optional.ofNullable( terms.get( id ) );
}

I'm currently working around this by storing all of the messages and terms from each resource before calling FluentBundle$Builder.addResource.

@xyzsd
Copy link
Owner

xyzsd commented Mar 19, 2025

Thanks. Seems like a good addition. Might be a bit before I am able to get to it though.

@NoahTheDuke
Copy link
Author

there's no rush, i appreciate any work you can do

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

2 participants