Giter Club home page Giter Club logo

localize's Introduction

Localize

Carthage compatible codecov.io CocoaPods Build Status Language GitHub license Awesome

Localize is a framework written in swift to help you localize and pluralize your projects. It supports both storyboards and strings.

Localize Storyboard


Features

  • Storyboard with IBInspectable
  • Pluralize and localize your keys
  • Keep the File.strings files your app already uses
  • Support Apple strings and JSON Files
  • Change your app language without changing device language
  • Localize your Storyboards without extra files or/and ids

Requirements

  • iOS 9.0+
  • Xcode 8.0+
  • Swift 3.0+

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

gem install cocoapods

CocoaPods 1.1.0+ is required to build Localize 1.+.

To integrate Localize into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'Localize' , '~> 2.3.0'
end

# If you are using Swift 4.x
# target '<Your Target Name>' do
#    pod 'Localize' , '~> 2.1.0'
# end

Then, run the following command:

pod install

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

brew update
brew install carthage

To integrate Localize into your Xcode project using Carthage, specify it in your Cartfile:

github "andresilvagomez/Localize"

Run carthage update to build the framework and drag the built Localize.framework into your Xcode project.

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding Localize as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .Package(url: "https://github.com/andresilvagomez/Localize.git")
]

Usage

Add .localize() for any String if you want localize.

You don't need import anything in your code, Localize uses extensions to localize your Strings.

textLabel.text = "hello.world".localize()
// Or
textLabel.text = "hello.world".localized

You can decide if you want use JSON or Apple Strings, we support both, if you decide to use JSON please follow these instructions.

Create JSON file

Please create a JSON file in your code with this rule:

{your file name}-{your lang code}.json

For example

  • lang-en.json
  • lang-es.json
  • lang-fr.json

Example JSON File

{
    "hello" : {
        "world" : "Hello world!",
        "name" : "Hello %!"
    },
    "values" : "Hello % we are %, see you soon",
    "username" : "My username is :username",
    "navigation.title" : ""
}

Create String file

If you decide use Apple strings, please follow Apple Localization Guide to create strings file.

String file example


"hello.world" = "Hello world!";

"name" = "Hello %";

"values" = "Hello everyone my name is % and I'm %, see you soon";

"username" = "My username is :username";

"level.one.two.three" = "This is a multilevel key";

"the.same.lavel" = "This is a localized in the same level";

"enlish" = "This key only exist in english file.";

Whatever way you choose to, use that methods.

Localize strings

print( "hello.world".localize() )

// Hello world!

// Also you can use

print( "hello.world".localized )

Localize strings, replacing text

Localize use % identifier to replace the text

print( "hello.name".localize(value: "everyone") )

// Hello everyone!

Localize strings, replacing many texts

Localize use % identifier to replace the text

print( "values".localize(values: "everyone", "Software Developer") )

// Hello everyone we are Software Developer, see you soon

Localize strings, replacing dictionary values

Localize use :yourid to search your id in JSON File

print( "username".localize(dictionary: ["username": "Localize"]) )

// My username is Localize

Localize strings, using other files

If you decide use different files use methods with tableName in the end of each method, for example.

print( "hello.world".localize(tableName: "Other") )

print( "hello.name".localize(value: "everyone", tableName: "Errors") )

print( "values".localize(values: "everyone", "Software Developer", tableName: "YourFileName") )

print( "username".localize(dictionary: ["username": "Localize"], tableName: "YourFileName") )

We are amazing with storyboards

You don't need to import anything in your code, Localize uses extensions to localize your UIView components

To prevent auto localization for some controls you created in storyboard can set Auto Localize to Off

Localize Storyboard

  • lang-en.json
{
    "navigation" : {
        "title" : "Localize"
    },
    "app" : {
        "label" : "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo. Nullam dictum felis eu pede mollis pretium.",
        "textfield" : "Write some here."
    }
}

You can use extensions for

  • UIBarButtonItem
  • UIButton
  • UILabel
  • UINavigationItem
  • UISearchBar
  • UISegmentedControl
  • UITabBarItem
  • UITextField
  • UITextView

Updating language

When you change a language, automatically all views update your content to new language

Localize.update(language: "fr")

To make this work with strings, you need to implement a notification

override func viewDidLoad() {
    super.viewDidLoad()
    NotificationCenter.default.addObserver(self, selector: #selector(localize), name: NSNotification.Name(localizeChangeNotification), object: nil)
}

public func localize() {
    yourLabel.text = "app.names".localize(values: "mark", "henrry", "peater")
    otherLabel.text = "app.username".localize(value: "Your username")
}

Implementing internal acction to change a language

@IBAction func updateLanguage(_ sender: Any) {
    let actionSheet = UIAlertController(title: nil, message: "app.update.language".localize(), preferredStyle: UIAlertControllerStyle.actionSheet)
    for language in Localize.availableLanguages {
        let displayName = Localize.displayNameForLanguage(language)
        let languageAction = UIAlertAction(title: displayName, style: .default, handler: {
            (alert: UIAlertAction!) -> Void in
            Localize.update(language: language)
            })
        actionSheet.addAction(languageAction)
    }
    let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.cancel, handler: {
        (alert: UIAlertAction) -> Void in
        })
    actionSheet.addAction(cancelAction)
    self.present(actionSheet, animated: true, completion: nil)
}

Config

This not is necesary, only if you need different results.

// AppDelegate.swift

import Localize

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

    let localize = Localize.shared
    // Set your localize provider.
    localize.update(provider: .json)
    // Set your file name
    localize.update(fileName: "lang")
    // Set your default language.
    localize.update(defaultLanguage: "fr")
    // If you want change a user language, different to default in phone use thimethod.
    localize.update(language: "en")
    // If you want remove storaged language use
    localize.resetLanguage()
    // The used language
    print(localize.currentLanguage)
    // List of available language
    print(localize.availableLanguages)

    // Or you can use static methods for all
    Localize.update(fileName: "lang")
    Localize.update(defaultLanguage: "fr")
    Localize.update(language: "en-DE")

    return true
}

Pluralize

print( "people".pluralize(value: 0) )
// there are no people

print( "people".pluralize(value: 1) )
// only one person

print( "people".pluralize(value: 2) )
// two people

print( "people".pluralize(value: 27) )
// many people

print( "people".pluralize(value: 103) )
// hundreds of people

print( "people".pluralize(value: 1010) )
// thousand of people

print( "people".pluralize(value: 1000000) )
// millions of people

how you need compose your file.

// Json file

{
    "people": {
        "zero": "there are no people",
        "one": "only one person",
        "two": "two people",
        "many": "many people",
        "hundreds": "hundreds of people",
        "thousand": "thousand of people",
        "millions": "millions of people",
        "other": "not defined people"
    }
}
# string file

"people.zero" = "there are no people";
"people.one" = "only one person";
"people.two" = "two people";
"people.many" = "many people";
"people.hundreds" = "hundreds of people";
"people.thousand" = "thousand of people";
"people.millions" = "millions of people";
"people.other" = "not defined people";

but also you can show your value

print( "people".pluralize(value: 1) )
/// 1 Person

in your file

// JSON
{
    "people": {
        "one": "% Person",
        ...
    }
}

// Strings
"people.one" = "% Person";

Notes for your AppStore release

To make all languages you have localized your app for visible on the AppStore, you must add a language in the project's settings.

  1. For that, click on your project name in the left side bar.
  2. Then, choose project, instead of a target.
  3. At the bottom, under Localizations, press the + button & select a language you want to add
  4. On prompt, uncheck all files Xcode wants to add localization for, but keep a single one, that you won't actually localize, such as your launch screen for instance.
    • if you need to localize all your files, I suggest adding a placeholder storyboard file that you'll then add to localization
  5. Done! (You don't actually have to localize the placehodler file.) The AppStore will now show the new language in localizations for your app.

Credits

Andres Silva Gomez

Special thanks to Benjamin Erhart

License

Localize is released under the MIT license. See LICENSE for details.

localize's People

Contributors

adbqpa avatar andresilvagomez avatar dclelland avatar gustavoggs avatar imryan avatar kazaimazai avatar linusgeffarth avatar pipemontoya avatar siberianbearr avatar simone-gasparini avatar tladesignz avatar unchi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

localize's Issues

Double request in one string - array

Issue

Doesn't grab both strings when put into one.

Localize Environment

  • **Localize version:Newest
  • **Xcode version:10.2.1
  • **Swift version:5
  • Platform(s) running Localize:
  • **macOS version running Xcode:10.14.2

What did you do?

"kingsen.game.mode.hearts".localize() + " kingsen.game.mode.jack".localize(), in an array

What did you expect to happen?

  • Hearts Jack
    To grab and show both of the strings

What happened instead?

  • Hearts kingsen.game.mode.jack
    It only grabs the first one. The second one is just displayed as kingsen.game.mode.jack instead of the string.

Updating the language for a tableview with separate tableviewcell files

Hi, thanks for your work.

I am trying to translate an app that is built with a tableviewcontroller and each row has a separate tableviewcell file, and each tableviewcell has a collectionviewcell. This is to present a view like NetFlix or the AppStore: collectionviews embedded in tableviews.

The problem with the translation comes when I want to translate in the HomeTableViewController file. Because the strings to translate are in the TableViewCell file, that has no viewdidload or viewwillappear.

Any help would be very much appreciated.

Problem with crashing because of memory increase when changing the language

Issue

Spanish and English are the two languages that my application supports. when I switch between languages several times. My system keeps crashing due to an increase in memory.

we have created file called lang-es.JSON to create Spanish keys.

Localize Environment

Localize version: (2.3.0)
Xcode version: 15.0 (15A240d)
Swift version: 4.2
Platform(s) running Localize: iOS 17
macOS version running Xcode: Sonoma 14.5

Localize Config

Localize.update(defaultLanguage: langCode)
Localize.update(language: langCode)

as i observed the code, memory is increasing due to

NotificationCenter.default.post(`
            name: Notification.Name(rawValue: localizeChangeNotification),
            object: nil
        )

inside the method update(language: String) of LocalizeCommonProtocol. Notification observer memory won't grow if I comment it out, and the language won't change either.

Crash on iOS8

On iOS 8 app crashes when You change the language after some ViewControllers was destroyed.

It crashes on line:
NotificationCenter.default.post(name: Notification.Name(rawValue: LocalizeChangeNotification), object: nil)
In method:
public func update(language:Languages) -> Void
Of class:
LocalizeCommonProtocol

It most likely because of not removing the observer from NotificationCenter that are added in awakeFromNib methods in extensions of UIControlls in file LocalizeExtensions.

This is not needed for iOS9 and above.
http://useyourloaf.com/blog/unregistering-nsnotificationcenter-observers-in-ios-9/

Fallback language

Is there a way to set the fallback languages if I want something different from what apple does?

Add support for external datasource

First of all let me thank you for the awesome library. It just saved me lots of code and helped keep things neat.

One feature I think would add value is option to add an external datasource other than App's Bundle. So, we could read from JSON files that is in application's documents directory. This helps to make the localisation files dynamic.

A simple use case would be the ability to push any changes to the strings to the app from server. The app could just replace contents in the documents directory. I am assuming we cannot alter contents in the Bundle. Correct me if I am wrong.

Static UITableView rows not localized properly

Issue

I have a static table that loads localized properly.
Once the language change, the rows' text change to the default (used in the cell xib)

Correct
Schermata 2020-05-13 alle 23 11 39

Wrong
Schermata 2020-05-13 alle 23 11 52

Localize Environment

  • Localize version: 2.3
  • Xcode version: 11.4.1
  • Swift version: 5
  • Platform(s) running Localize: iOs 13.4.1
  • macOS version running Xcode: Catalina 10.15.4

Localize Config

My localized JSON files are in a sub-folder
Schermata 2020-05-13 alle 23 17 23

// Localize
let localize = Localize.shared
localize.update(provider: .json) // Set your localize provider.
localize.update(fileName: "lang") // Set your file name
// Set language based on system
let locale = Locale.preferredLanguages.first?.components(separatedBy: "-").first?.lowercased() ?? "en"
localize.update(language: locale)

What did you do?

Here the code I'm using for creating the table

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        
        let cell = tableView.dequeueReusableCell(withIdentifier: "configCellIdentifier", for: indexPath) as! CellWithIconTableViewCell
        cell.accessoryType = .disclosureIndicator
        
        // THIS IS THE JSON FILE
        //"account": {
        //    "update-language": "Choose the new language",
        //    "static-table": {
        //        "ranking": "Check your rank",
        //        "account": "Account",
        //        "support": "Support",
        //        "about": "About",
        //        "language": "App language"
        //    }
        //},
        
        switch indexPath.section {
        case 0:
            switch indexPath.row {
            case 0:
                cell.setProperties(icon: UIImage(named: "glyphicons-basic-393-medal"), text: "account.static-table.ranking".localized)
                return cell
            case 1:
                cell.setProperties(icon: UIImage(named: "glyphicons-basic-4-user"), text: "account.static-table.account".localized)
                return cell                
            default:
                break
            }
        case 1:
            switch indexPath.row {
            case 0:
                cell.setProperties(icon: UIImage(named: "glyphicons-basic-587-bug"), text: "account.static-table.support".localized)
                return cell
            case 1:
                cell.setProperties(icon: UIImage(named: "glyphicons-basic-196-circle-empty-info"), text: "account.static-table.about".localized)
                return cell
            case 2:
                cell.setProperties(icon: UIImage(named: "glyphicons-basic-419-worl-east"), text: "account.static-table.language".localized)
                cell.accessoryType = .none
                return cell
            default:
                break
            }
        default:
            break
        }
        
        return UITableViewCell()

    }

This is the code used for changing the language

private func chooseLanguage() {
        let actionSheet = UIAlertController(
            title: nil,
            message: "account.update-language".localize(),
            preferredStyle: UIAlertController.Style.actionSheet
        )
        
        for language in Localize.availableLanguages {
            let displayName = Localize.displayNameForLanguage(language)
            let languageAction = UIAlertAction(
                title: displayName,
                style: .default,
                handler: { (_: UIAlertAction!) -> Void in
                    Localize.update(language: language)
            })
            actionSheet.addAction(languageAction)
        }
        let cancelAction = UIAlertAction(
            title: "general.alerts.cancel".localize(),
            style: UIAlertAction.Style.cancel,
            handler: nil
        )
        
        actionSheet.addAction(cancelAction)
        self.present(actionSheet, animated: true, completion: nil)
    }

What did you expect to happen?

I expect to see the right localization

What happened instead?

The rows present the default text

Feature Request: create variables from .json / .strings

A new feature I'd love to have in this library (which would take huge efforts, I believe, though) would be to integrate the feature that Laurine has.

Ported over, it would look something like this:

lang-en.json

{
    "login": {
        "welcome": "Hey %, what's up?"
        "username": "Username",
        "password": "Password"
    }
}

ViewController.swift

welcomeLabel.text  = Localize.login.welcome(value: "Andres") // Hey Andres, what's up?
usernameLabel.text = Localize.login.username

That'd be super awesome!

Cannot display the correct localization

Hi, I have a problem using this localization framework.

Here is the step I have done

  1. install localize using cocoapods
  2. import Localize in AppDelegate.swift and put below code inside "application" function
    let localize = Localize.shared
    localize.update(provider: .json)
    localize.update(fileName: "lang")
    localize.update(defaultLanguage: "en")
    print(localize.language())
    print(localize.availableLanguages())
  3. then, I created "lang-en.json" and put it inside my working folder
  4. I add print("hello.world".localize()) somewhere in the viewController
  5. I tried to run the program
  6. the result which is shown in the console is
    en
    []
    hello.world

Am I missing something? or they cannot find my "lang-en.json" file?

Thank you

Localize UIElements

How would I go about localizing the following UIElements...

  • UISegmentedControl's titles
  • UITextField's placeholders?

...all in storyboard?

Not add English option

Issue

ℹ Please provide a quick description for this issue.

Localize Environment

  • Localize version:
    4.1.0
  • Xcode version:
    10.1
  • Swift version:
    4.2
  • Platform(s) running Localize:
    iphone
  • macOS version running Xcode:

Localize Config

/// Please put here your config
lang-en, lang-fr, lang-sv
It shows only fr and sv 2 options, not showing en options.

What did you do?

ℹ It does not add english option
.for language in Localize.availableLanguages {
let displayName = Localize.displayNameForLanguage(language)
let languageAction = UIAlertAction(
title: displayName,
style: .default,
handler: { (_: UIAlertAction!) -> Void in

                Localize.update(language: language)
        })
        actionSheet.addAction(languageAction)
    }

Podspec file does not validate when added resource_bundle for localization in 'BinaryFramework'

Issue

ℹ Please provide a quick description for this issue.

Xcode - 11.5
MacOS - 10.15.3
Swift - 5

Localize Config

Pod::Spec.new do |s|

s.platform = :ios
s.ios.deployment_target = '11.1'
s.name = "*"
s.summary = "
for customer."
s.requires_arc = true

s.version = "0.1.2"

s.license = { :type => "MIT", :file => "LICENSE" }

s.author = { "Swapnil G" => "**" }

s.homepage = "***"

s.source = { :git => "***",
:tag => "#{s.version}" }

s.ios.framework = "UIKit"
s.framework = "WebKit"
s.ios.framework = "HealthKit"

s.dependency 'SQLite.swift','> 0.12.2'
s.dependency 'Alamofire', '
> 4.9.1'
s.dependency 'Charts', '> 3.4.0'
s.dependency 'CryptoSwift', '
> 1.3.0'
s.dependency 'NVActivityIndicatorView', '> 4.8.0'
s.dependency 'SwiftSoup', '
> 2.3.0'
s.dependency 'SwiftyJSON', '> 5.0.0'
s.dependency 'DropDown', '
> 2.3.13'
s.dependency 'HGCircularSlider', '> 2.2.0'
s.dependency 'RealmSwift', '
> 4.3.2'

s.dependency 'HGCircularSlider', '> 2.2.0'
s.dependency 'DropDown', '
> 2.3.13'

s.source_files = ".framework/Headers/*.h"
s.public_header_files = "
.framework/Headers/*.h"
s.vendored_frameworks = "**.framework"

s.resource_bundle = { "**" => ["Localize/.lproj/.strings"] }

s.swift_version = "5.0"

end

What did you do?

Added strings file for hindi and english language checked with normal framework (not binary framework), it works as expected but not with the binaryframework

What did you expect to happen?

Localization should work for binaryframework also.

What happened instead?

Validation failed with error - [iOS] file patterns: The resource_bundles pattern for Framework_Bundle did not match any file.

Localize with parameter not work

Hi!
I am trying to localize a key like this:
"This_is_key" = "You have % apples";
But it always fallback to base language. (in my case, I localize for Vietnamese). But the key without parameters still working in Vietnamese.

I tried so many ways but it still not working.

Please check

Determine whether a localization exists for a key

For error messages, I try to generically access the localized strings.

Example json:

"errors": {
    "some_error": "Something went wrong!",
    "some_other_error": "We're not sure what's happening..."
}

From the API, I receive an error code and would like to do:

let errorCode = ... // from API response
let errorMessage = "errors.\(errorCode)".localized

Now, in case I forgot to add localization for an error code, or the backend added a new error code, before I was able to update the app, I'd like to do a fallback, when there's no localized string for this key.
Currently, I compare the returned string to the key:

let key = "errors.\(errorCode)"
if key.localized != key {
    errorMessage = "There's an unknown error."
}

However, I'd much rather do something like this:

let key = "errors.\(errorCode)"
if Localize.shared.localizationExists(forKey: key) {

See a possible implementation for this below:

/// Determines whether a localized string exists for given key
///
/// - parameter key: localization key
/// - returns: boolean value determining whether a localized string exists for give key
public func localizationExists(forKey key: String) -> Bool {
    return key.localized != key
}

Display Languages in their original languages.

Greetings, dear Localize developer!
Your work is immaculate and useful beyond belief. Your guides are simple and easy to follow and It helped me save tons of time. The only thing I was wondering about is why not display languages in their original, i.e. action sheet now displays list of languages in the language currently chosen.

  • English
  • French
  • Cancel
    What could be even better is to give an option (or set as default) to show them like this:
  • English
  • Francais
  • Cancel

How it looks now:
screen shot 2018-05-25 at 11 12 45 am 2

How IMHO would be better:
screen shot 2018-05-25 at 11 12 45 am 2 copy 2

PS. For some reason, O'zbek is written as O'Zbek (capital Z), could you please fix that too. I'd do it myself, I just don't know how.

How to handle Localizable.strings file

Hi,
This is not an issue according to this pod. I already used this pod in another iOS application. It is nice and very easy to understand and easy to implement.
I have a situation here. I am working a project which already contains localization file for the two languages. The code is written is like this for the text.
NSLocalizedString("Use_Thumb", comment: "")

Is there any possibility to use this pod to handle the Localizable.strings file. If possible. How to use it.

The project is updated to swift 4.2 version.

please give suggestions.

screen shot 2019-02-23 at 12 37 24 pm

Keep the string that had localize key

Base on your example, what if I want to keep the string "app.label" without remove its key. For example, I want to localize "app.label" in the first viewcontroller but I don't want to localize "app.label" in the second viewcontroller. Any solutions ?

Not localizing automatically

First off, thanks for this awesome library. I love how simple, yet flexible, it is!
Keep up the good work!


I've setup localization for English and German: lang-en.json, lang-de.json.
It works perfectly when manually setting the language in code by doing localize.update(language: "de").
However, it does not automatically set the language when changing my device's language.

Am I missing something?


Update:

I figured I could manually set the language to the device's language by passing...

Locale.preferredLanguages.first?.components(separatedBy: "-").first.lowercased ?? "en"

...as language code.
Is this the way it's supposed to be?

How to use in Objective-C ?

My project is mixing between swift and objective-c.
I can't find the instruction to use with objective-c view controller.

System button with default title/change in runtime not localized correctly

Issue

System button with default title/change in runtime not localized correctly

Localize Environment

  • Localize version: (2.1.0)
  • Xcode version: 10.1 (10B61)
  • Swift version: 4.0
  • Platform(s) running Localize: iOS
  • macOS version running Xcode: 10.14.2 (18C54)

Localize Config

Localize.update(fileName: "Localization")
Localize.update(defaultLanguage: "en-US")
Localize.update(language: "en-VN")

What did you do?

I had a button (from storyboard) with default title is "Start Reading". In the runtime, that button can be change to "Resume chap.1" for example. It work perfect until I hit that button, the title fade to "Start Reading" instead of "Resume chap.1". The title only change when click and hold the finger on it, after releasing, it fade back to correct title "Resume..." The button I use is system type

Button type: Default system type
Default title: "Start Reading"
Runtime title: "Resume chap.1"
Click & hold button: Fade to "Start Reading"
Release button: Fade to "Resume chap.1"

Swift tool version error

Issue

Hello, I have added this library by SPM and I have an error:
Error

Localize Environment

  • Localize version: I fetched master
  • Xcode version: 14.0.1
  • Swift version: 5

Localize Config

default

Btw. Will you make new release? If I want to have latest code I need to get master branch, not version.

UITabbar text not updated until app restart

Issue

ℹ Please provide a quick description for this issue.
Tabbar string not refreshed until app restart

Localize Environment

  • Localize version: 2.3.0
  • Xcode version: 12.5

Localize Config

/// Please put here your config
UITabBarItem(title: "More_title".localize(), image: UIImage(named: "icon-more-menu"), tag: 4)

What did you do?

ℹ I try to change the language from setting page.

What did you expect to happen?

ℹ The tabbar text should change to respective language immediately.

What happened instead?

ℹ It didnot changed to latest updated language.

Support for simplified and traditional Chinese

Issue

The library does not handle properly languages that are coded by iOS in three components. I have tried to include translation for both simplified and traditional Chinese. The language variable is set as follow:

  • zh-Hans-US for simplified Chinese
  • zh-Hant-US for the traditional Chinese

However, I cannot create json resource with the name zh-Hans-US / zh-Hant-US as last component encode the regional settings. In my case it is US. I have tried to name files: lang-zh-Hant.json and lang-zh-Hans.json but it results in selecting default language as the library always fall back to the single component file name (lang-zh.json) which also cannot be found.

Localize Environment

  • Localize version:
  • Xcode version:
  • Swift version:
  • Platform(s) running Localize:
  • macOS version running Xcode:

Localize Config

/// Please put here your config

What did you do?

ℹ Please replace this with what you did.

What did you expect to happen?

ℹ Please replace this with what you expected to happen.

What happened instead?

ℹ Please replace this with of what happened instead.

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.