ProductPromotion
Logo

Swift

made by https://0x3d.site

GitHub - Decybel07/L10n-swift: Localization of the application with ability to change language "on the fly" and support for plural form in any language.
Localization of the application with ability to change language "on the fly" and support for plural form in any language. - Decybel07/L10n-swift
Visit Site

GitHub - Decybel07/L10n-swift: Localization of the application with ability to change language "on the fly" and support for plural form in any language.

GitHub - Decybel07/L10n-swift: Localization of the application with ability to change language "on the fly" and support for plural form in any language.

Build Status CocoaPods Version Language Swift4 CocoaPods License Pod method Compatible Mentioned in Awesome-swift

L10n-swift is a simple framework that improves localization in swift app, providing cleaner syntax and in-app language switching.

Overview

🌟 Features

  • Change the language of your apps "on the fly".
  • IBInspectable for Xcode Interface Builder (Cocoa - coming soon).
  • Support for user-defined Localizable file names.
  • Support for formats: *.plist, *.json, *.stringsdict, *.strings.
  • Support for grouping localization keys.
  • Support for plural forms in any language with multiple arguments.
  • Support for pseudo-languages: NonLocalized, DoubleLength, Accented, Bounded, ForcedRightToLeft.
  • Use .l10n() to localize any string, date and numbers.
  • Use more than one language at the same time.
  • About 25 times faster than a native solution.

💻 Demo

pod try L10n-swift

⚠️ Requirements

  • iOS 9.0+ | macOS 10.10+ | tvOS 9.0+ | watchOS 2.0+
  • Swift 4.0+

👥 Communication

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

📗 Installation

Core Extension IBInspectable
L10n-swift ✔️ ✔️ ✔️
L10n-swift/Core ✔️
L10n-swift/Extension ✔️ ✔️
L10n-swift/IBInspectable ✔️ ✔️

CocoaPods

pod 'L10n-swift', '~> 5.10'

Carthage

github "Decybel07/L10n-swift", ~> 5.10

Swift Package Manager

.Package(url: "https://github.com/Decybel07/L10n-swift.git", majorVersion: 5)

📘 Usage

Import L10n_swift at the top of each Swift file that will use framework.

import L10n_swift

Get localized text

Add .l10() following any String object you want localized:

"hello.world".l10n()

Get localized number

Add .l10() following number you want localized. Using the number format for the current language:

12.l10n()
24.l10n(minIntegerDigits: 4)
1.61803.l10n()
2.71828.l10n(fractionDigits: 2)

3.14.l10n { formatter in
    formatter.numberStyle = .currency
}

Get localized date

Add .l10() following any Date object you want localized using the date format for the current language:

Date().l10n()

Date().l10n { formatter in
    formatter.dateStyle = .medium
}

Get plural

Add .l10nPlural(CVarArg...) following any String object you want translated with plurals:

"numberOfApples".l10nPlural(2)

More about plurals, you can read on wiki

Observe language changed

Add observer for notification L10nLanguageChanged. This notification is called when language has been changed.

NotificationCenter.default.addObserver(
    self, selector: #selector(self.yourFunction), name: .L10nLanguageChanged, object: nil
)

Set language

L10n.shared.language = "en"
L10n.shared.language = "en-GB"

At runtime, you can switch the language at any time by setting the language property.

Get current language

L10n.shared.language

Get locale for current language

L10n.shared.locale

Get list of supported languages

L10n.supportedLanguages

A list of all the languages contained in the main bundle.

Get preferred language

L10n.preferredLanguage

A preferred language contained in the main bundle.

Supported formats

.plist, .stringsdict

More about .plist format you can read on wiki.

More about .stringsdict format you can read on wiki.

.json

More about .json format you can read on wiki.

.strings

More about .strings format you can read on wiki.

📙 FAQ

🤓 Author

Adrian Bobrowski (Decybel07), [email protected]

🔑 License

L10n-swift is available under the MIT license. See the LICENSE file for more info.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory