Skip to content
This repository has been archived by the owner on Nov 29, 2018. It is now read-only.

IStringLocalizer.GetAllStrings should support an arg to specify culture walk behavior #23

Closed
DamianEdwards opened this issue May 20, 2015 · 5 comments

Comments

@DamianEdwards
Copy link
Member

Depends on #18

Currently, IStringLocalizer.GetAllStrings will return the union of all strings for the current culture and all ancestors of the current culture. E.g. if the current culture is "en-US" and it contains a single string "Hello", and the culture "en" contains a single string "Goodbyte", the call to IStringLocalizer.GetAllStrings for "en-US" will return both the "Hello" and "Goodbye" strings.

This behavior may not always be desirable (e.g. it differs to how ResourceManager.GetResourceSet works). As such, we should support a way to specify the behavior during the call, e.g. GetAllStrings(includeAncestorCultures: false);

The default behavior should still be to include strings from ancestor cultures.

@DamianEdwards
Copy link
Member Author

Interested in your thoughts @davidfowl @muratg @Eilon @lodejard

@muratg
Copy link

muratg commented May 21, 2015

I like it.

@glen-84
Copy link

glen-84 commented May 25, 2015

So if you have "colour" in "en", and nothing in "en-US", the translation for "en-US" would be "colour", which is not correct until such time as you "override" it as "color" in "en-US"? Perhaps it should be off by default to avoid unexpected behaviour?

(sorry, I know public feedback was not requested 😨)

DamianEdwards added a commit that referenced this issue May 28, 2015
…le impl:

- #18

Support not loading ancestor culture strings on IStringLocalizer.GetAllStrings:
- #23
@DamianEdwards
Copy link
Member Author

@glen-84 this behavior is in line with the existing ResourceManager.GetString behavior, that walks the culture graph until it finds a string. We're simply adding that same behavior to the GetAllStrings scenario. People can call the overload with the behavior they desire.

@glen-84
Copy link

glen-84 commented May 29, 2015

Okay, fair enough I suppose.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants