Giter Site home page Giter Site logo

Comments (1)

Decybel07 avatar Decybel07 commented on July 17, 2024

1. While I am changing app language it is not changing language of storyboard. It only changes string which is hard coded in code.

Yes you'r right. Unfortunately, currently I can't do anything with it, but you can check my answer for similar issue #7

L10n.shared.language = "fr" this property don't reload views! It only sets language for future localization.

For reload all text you need to re-localization all the texts (using @IBOutlets) or you have to reload all visible controllers in your application. Look at this example.

2. While I Re-Run app it runs with default language not with previously selected language

This library doesn't store the user's set language between application sessions. If you want to get this functionality, then on the side of your application you should take care of storing and restoring this language.

Example

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(_: UIApplication, didFinishLaunchingWithOptions _: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        // restore
        if let language = UserDefaults.standard.string(forKey: "language") {
            L10n.shared.language = language
        }
        
        // store
        NotificationCenter.default.addObserver(forName: .L10nLanguageChanged, object: self, queue: nil) { _ in
            UserDefaults.standard.set(L10n.shared.language, forKey: "language")
        }
        
        return true
    }
}

from l10n-swift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.