Comments (7)
Could this be a pt
versus pt_BR
issue maybe?
from nsdate-timeago.
I don't know. What would you suggest @kevinlawler?
from nsdate-timeago.
Should I need to set anything else?
from nsdate-timeago.
Hmm, the bundled localization isn't applied for me either, actually, although in my case it's the Czech localization that should be loaded. Since I'm not really experienced when it comes to the NSBundle
class and bundles in general, I tried pretty much everything that seemed even slightly relevant to the issue to me, including changing the “Localization native development region” property in the Info.plist
file, changing the device's system language (tried in both Simulator and on real device), toying with the NSDateTimeAgoLocalizedStrings(key)
macro, but with no result.
Is there some step I'm missing? From my little “research” it almost seems that this line of code (line 11 in NSDate+TimeAgo.m
isn't doing what it's supposed to do:
[NSBundle bundleWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"NSDateTimeAgo.bundle"]]
Toying with the Simulator showed that the NSDateTimeAgo.bundle
copies successfully to the application bundle, but it just doesn't get loaded.
Oh, and last thing to mention, I'm of course using CocoaPods to install NSDate+TimeAgo.
from nsdate-timeago.
When localizations were moved inside the NSDateTimeAgo bundle (instead of being loose in the app bundle) they were no longer included in projects by default. The upside of this was that if you didn't want a localization supported, it wouldn't be triggered by this library. The downside was that if you wanted time values translated for locales by default, translation was no longer triggered simply by adding NSDate+TimeAgo to your project. It may be possible to get the best of both worlds here. That work has not been done yet.
In the meantime, you can likely solve your problem by manually enabling localization for your preferred language. I believe there are several ways to do this. One way is by going to Project -> Info -> Localizations and adding an entry for the language there. It does not matter what the contents of the entry are. This will cause, say, a cs.lproj
or pt.lproj
directory to be added inside both the project source folder and in the resulting .app
package when the project is built. Apparently, the presence or absence of an lproj
folder is what determines whether or not a localization is supported.
For testing purposes, you may also want to edit the main
call in your main.m
file to include the following, after the initialization of the autorelease pool, but before UIApplicationMain
[[NSUserDefaults standardUserDefaults] setObject: [NSArray arrayWithObjects:@"pt", nil] forKey:@"AppleLanguages"];
[[NSUserDefaults standardUserDefaults] synchronize];
where @"pt" is your desired language. This will cause localizable strings to appear in the designated language. The above snippet will require relaunching the app. It is of course not suitable for production release.
from nsdate-timeago.
This fixed my issue. Thanks!
from nsdate-timeago.
Ha, that worked wonderfully! Thanks a lot for the advice (and apologies for belated reply, too many things demanding my time and attention lately and I just got to trying your suggestion now).
from nsdate-timeago.
Related Issues (20)
- Time Ahead HOT 3
- "3 месяцев назад" -> "3 месяца назад"
- Swift 3
- Persian (fa) localization
- Crashing in iOS 10.2 version only in release version
- Bahasa Strings HOT 2
- Slovak strings - rename file
- How to add New Language ?
- let dateFormatter: NSDateFormatter = NSDateFormatter()
- time to HOT 2
- Part of zh-Hans.lproj is not right
- I cannot import pod to Swift project HOT 8
- arm64 Support!
- iOS8.0 deprcated HOT 2
- Swift timeAgo returns empty string. HOT 6
- Carthage Support
- Pluralization dont work because wrong RU locale code HOT 1
- Projects including this file are unable to export XLIFFs in Xcode 6.3 and up. HOT 2
- Push to Cocoapods Trunk HOT 7
- French localization should be improved
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nsdate-timeago.