Giter VIP home page Giter VIP logo

localize-swift's People

Contributors

basthomas avatar dependabot[bot] avatar dimohamdy avatar dreamolight avatar fassko avatar jameshartt avatar jedmund avatar lowell avatar marmelroy avatar marmelroyspotify avatar mbrgm avatar nekrich avatar rokoroku avatar rshev avatar sonswift avatar tuononh avatar wanewang avatar ziper1 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  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

localize-swift's Issues

iOS 7 support

When trying to install via cocoapods, if your project has a deployment target earlier than 8.0 (the one the pod is built with), you cannot install the pod.
According to the docs, Swift 2.0 is backwards compatible with iOS 7.0.

Appreciate the work!

No such module 'Localize_Swift'

I would like to use the framework, but even following all the instructions I am still unable to build my app because of the No such module 'Localize_Swift' error. I did my research and tried the most common solutions for when a module is not found and none of them worked.

I have downloaded your example app fro GitHub and I am getting the same error when trying to build the app, which makes me think there is probably something broken or missing in the framework itself. Are you aware of any issue using the framework with Xcode 8 and Swift 3?

Remove Base language

Hi Roy :)
Right now my alertController look like this:
screen shot 2016-05-25 at 10 45 28 pm

How can i remove the base language. When i

print(self.availableLanguages)

. I get this result ["Base", "en", "fr"]. But I just want ["en, "fr"].

Thank you very much!

String with variable

Hi Roy :)

How can I localized this?

let name = NSUserDefaults.standardUserDefaults().valueForKey("name") as! String
searchBar.placeholder = "Hey, \(name) how can we help you?"

the name change depend on which user is currently logged in.
Btw thank you very much!

views automatically localized to arabic.

I tried this library for in-app localization. In case the device language is english, this library works fine. But in case the device language is arabic, the views automatically use right to left orientation which distort the UI.

Does not work in UITests

Having tried all day, I cannot get Localize-Swift to work in UITests. Apparently this could have something to do with the wrong bundle being used.

(lldb) po NSLocalizedString("PASSWORD", comment: "")
"PASSWORD"

(lldb) po NSLocalizedString("PASSWORD", bundle: NSBundle(path: NSBundle(forClass: CaribooUITests.self).pathForResource("en", ofType: "lproj")!)!, comment: "")
"Password"

(lldb) po "PASSWORD".localized()
"PASSWORD"

I have no idea how to implement this and would appreciate help !

Include Localizable.strings content in xCode's "export for localization"

Hello,
is there a way to include the content of Localizable.strings in xCode's exported for translation .xliff files?
At the moment, it doesn't work because xcode searches for NSLocalizedString in code, not for actual content in Localizable.strings
If you have any thought, it will be much appreciated.
Thanks

Local date

var dateFormatter = NSDateFormatter() override func viewDidLoad() { super.viewDidLoad() dateFormatter.dateStyle = .MediumStyle let timeString = "\(dateFormatter.stringFromDate(NSDate()))" dateLbl.text = timeString print(timeString) }

Hi Roy, how can I Localized a date? Is it possible?

Thank you very much!

No right-to-left

There is no support for right to left layouts like Arabic Language

Support ignored directories with genstrings.py

Running genstrings.py currently searches all directories, including Examples in the Carthage Checkouts folder. For instance, I get this output:

/*
 * ./Carthage/Checkouts/Localize-Swift/examples/LanguageSwitch/Sample/ViewController.swift
 */

"Hello world" = "Hello world";

"Change" = "Change";

"Reset" = "Reset";

It would be helpful to have an --ignore option to ignore certain directories.

Tag not found

while building a swift project for MacOS i encountered the following problem:

`error: The dependency graph could not be satisfied. The package (https://github.com/marmelroy/Localize-Swift.git) with version tag in range (1.6.0..<1.6.1) is not found. Found tags ([0.0.1, 1.1.1, 1.1.2])`

My Package.swift:

import PackageDescription
let package = Package(
name: "test_swift",
dependencies: [
.Package(url: "https://github.com/marmelroy/Localize-Swift.git", "1.6.0")
]
)

Carthage build error in Xcode8 & Swift 3.0

Hi,
while i'm trying to compile the Localize-Swift using carthage. i'm getting an Error.

The log file:
“Use Legacy Swift Language Version” (SWIFT_VERSION) is required to be configured correctly for targets which use Swift. Use the [Edit > Convert > To Current Swift Syntax…] menu to choose a Swift version or use the Build Settings editor to configure the build setting directly.

Environment:
Xcode 8.0 Build version 8A218a
Swift 3.0
carthage version 0.18
Localize-Swift

Cartfile
github "marmelroy/Localize-Swift" "swift3.0"

Suggestion: Change the Localized() method name to localized() to match style best practices

The library looks great! I believe that the Localized() method should be renamed to localized() though as Swift conventions dictate that method names start with a lowercase letter. For instance, check out this style guide: https://github.com/raywenderlich/swift-style-guide

Use descriptive names with camel case for classes, methods, variables, etc. Class names should be capitalized, while method names and variables should start with a lower case letter.

Wrong .lproj path if base localization is en

Base localization is English, added a new localization in Korean.

NSBundle.mainBundle().localizations returns ["Base", "ko", "en"]

Localize.currentLanguage() returns "en" instead of "Base" and since en.lproj doesn't exist localization string for English is not showing.

func localized() -> String {
    if let path = NSBundle.mainBundle().pathForResource(Localize.currentLanguage(), ofType: "lproj"), bundle = NSBundle(path: path) {
        return bundle.localizedStringForKey(self, value: nil, table: nil)
    }
    return self
}

.localized() always returns English version

Hello,

No matter what I am doing, after settings the language to any different language than "en", I always get translations from Localizable.strings of my en.lproj.

I am using:
Localize.setCurrentLanguage("fr-FR")

and then after LCLLanguageChangeNotification notification, I call:
backButton.setTitle("Back".localized(), forState: .Normal)

The result is always the string "BACK".

Am I doing something wrong?

Thanks!

Default language changed and more

I finally got Localize-Swift imported and "working" but my app now loads in French rather than the base or English.

Also, I have a button to toggle the language and reload a localized PList but it's not working. What steps do I need to take to make the toggle reload the PList in different languages?

Thanks!

[Question] Localize Swift

".".localized
".
".localized.comment(".")
".
".localizedFormat(arg1, "arg2", 3)
".".localizedFormat(arg1, "arg2", 3).comment(".")
".".localizedPlural("s")
".
".localizedPlural("s").comment(".*")

What do you think about:

  1. Removing parentheses from localized, making it computable property
  2. What do you think about adding comments in this way
  3. How to achieve parsing of strings and comments in O(n)
  4. Is it possible for localizedFormat include arguments in comment
  5. Is it possible to determine variable.localized and change variable with it declaration

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.

Can't run on i386

If I try to run my app on iPhone 5 or iPhone 4s (using the simulator), xcode doesn't compiles and gives this error
Localize_Swift, file was built for x86_64 which is not the architecture being linked (i386)

I've imported the library using Carthage.

Anything I can do?

which pod version to use?

I see the current version is 1.5 but readme writes 1.1, do you mind updating it? Or is there a reason why we might want to use 1.1?

Thanks.

Storyboards don't get localized

Hello guys, I am facing an issue with the storyboard files.
They don't get localized? Am I doing something wrong, or is this feature not possible?

Can't implement it with UI Segment Control

Hi Guys it's not a issue it's just I can't understand how to implement it.

screen shot 2016-02-07 at 23 10 07

I have this code:
@IBOutlet weak var CCountry: UILabel!

override func viewDidLoad() {
        super.viewDidLoad()
        CCountry.text = "Country".localized() 
        let langs = Localize.availableLanguages()
        print(langs[2])
@IBAction func IndexChanged(sender: UISegmentedControl)
    {
        var language: String = ""
        switch self.LangChoser.selectedSegmentIndex
        {
                case 0: language = "de"
                NSNotificationCenter.defaultCenter().addObserver(self, selector: "changeText", name: LCLLanguageChangeNotification, object: nil)

                case 1: language = "fr"
                NSNotificationCenter.defaultCenter().addObserver(self, selector: "changeText", name: LCLLanguageChangeNotification, object: nil)

                default: 
                break;
        }

        func changeText (notification: NSNotification)
        {
            Localize.setCurrentLanguage(language)
        }
    }

Please if you can guide what I'm doing wrong here, thanks in advance.

xCode8 with Swift2.3

Hi, is there Carthage support for xCode8+Swift2.3? At the moment I can't move straight to Swift3 because some other frameworks that I'm using are not updated.

multi Viwe control

hi
i have multi view control and storyboard .
How do I change all together؟

Refreshing the storyboard on language change

Is there any way to reload a storyboard when you change the language? Currently when I change the language the Strings with .localized() work but the storyboard does not change at all.

localizedFormat not picked up by genstrings.py

Given this

"\nAnd %d more!".localizedFormat(aNumber)

genstrings.py doesn't generate any output for this string.

The reason behind this is because the regex matches localizedWithFormat, a non existing method.

Can not get localized string in swift files using genstrings.py

I am using Swift 2 and have already import Localize to do i18n.

Everything works well, but i can not use genstrings.py to get the localized source string in swift files:

In swift file( test.swift):
label.text = "Name".localized()

after i run genstrings.py, nothing in the terminal, i suppose it could be like this:

/*

  • ./test.swfit
    */

"Name" = "Name";

I am not familiar with RE and Python, after i tried many times, it still can not work as i hope.

can you help to fix it?

Custom Font Support

How to change custom font based on language that i changed?

Adding Custom Font Support is appreciated.

Please support osx

The platform of the target ShadowsocksX-NG (OS X 10.10) is not compatible with Localize-Swift (1.1.2), which does not support osx.

Swift 2.2 Branch

Hello there,

Is there an older version or branch that supports Swift 2.2?

Set CFBundleLocalizations in info.plist

I found if I add "Chinese(traditional)" into CFBundleLocalizations,
Localize.availableLanguages() will return
["zh_TW", "de", "en", "es", "fr", "he", "it", "ja", "zh-Hans", "zh-Hant"]

without CFBundleLocalizations will return
["de", "en", "es", "fr", "he", "it", "ja", "zh-Hans", "zh-Hant"]

zh_TW is same as zh-Hant but project doesn't have zh_TW.lproj,
so "Localize" always use defaultLanguage().

Not working localization!

Hello!
I installed by cocoapods,
this is my code:

 let langs = ["kk", "ru", "en"]
                if i > 0 && i < langs.count {
                    Localize.setCurrentLanguage(langs[i])
                    let langStr = Locale.current.languageCode
                    print("yazik: \(langStr)")


and it is prints: only English, whenever I set other language:(

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.