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

Create sample data when user signup #392

Open
antonini opened this issue Apr 10, 2014 · 0 comments
Open

Create sample data when user signup #392

antonini opened this issue Apr 10, 2014 · 0 comments

Comments

@antonini
Copy link

Well, I'm trying to to create sample data when the user signup.
I did it on the method save(Identity) of the UserService but the problem is that on this method I don't have the user language, context or even the request to translate the sample data.

How can I get the user language? I've used the code below but it always bring my machine language (Locale.getDefault()):

    if (play.mvc.Http.Context.current.get() != null) {
        lang = play.mvc.Http.Context.current().lang();
        logger.debug("Has a Context!!" + lang);
    } else {
        logger.debug("No Context!! :(");
        Locale defaultLocale = Locale.getDefault();
        lang = new Lang(defaultLocale.getLanguage(), defaultLocale.getCountry());
    }

Is there a correct / better place to do that? Can I access the user language on that place?

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

1 participant