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

Where should the I18n.configure() be put? #12

Closed
eeschimosu opened this issue Sep 9, 2015 · 5 comments
Closed

Where should the I18n.configure() be put? #12

eeschimosu opened this issue Sep 9, 2015 · 5 comments
Labels

Comments

@eeschimosu
Copy link

The method I18n.configure() should be in the didFinishLaunchingWithOptions method of the appDelegate?

@tomkowz
Copy link
Owner

tomkowz commented Sep 9, 2015

It should be called before you ask for the first time for some translation. application:didFinishLaunchingWithOptions: is the best place.

@Jeehut
Copy link

Jeehut commented Jan 14, 2016

Just a question: Why is there a need for configuring Swifternalization at all? Couldn't it just configure itself if it wasn't configured yet on the first call of a localizedString method? I'm thinking about something like this:

public class func localizedString(key: String, stringValue: String, fittingWidth: Int? = nil, defaultValue: String? = nil, comment: String? = nil) -> String {
    guard sharedInstance.isConfigured else {
        sharedInstance.load(NSBundle.mainBundle())
    }
    // more code
}

This way configuration would be optional.

@tomkowz
Copy link
Owner

tomkowz commented Jan 14, 2016

@Dschee Indeed, that could work I think. Good catch!

@tomkowz tomkowz added the next label Feb 13, 2016
@tomkowz
Copy link
Owner

tomkowz commented Feb 13, 2016

Added configureIfNeeded method that is called internally but still keeping configure(bundle:) in case someone want to configure it with different bundle.

Will be available in the next release.

Thanks!

@tomkowz tomkowz closed this as completed Feb 13, 2016
@tomkowz tomkowz reopened this Feb 13, 2016
@tomkowz
Copy link
Owner

tomkowz commented Feb 13, 2016

1.3.1 Released.

@tomkowz tomkowz closed this as completed Feb 13, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants