microsoft / localizedstringkit Goto Github PK
View Code? Open in Web Editor NEWGenerate .strings files directly from your code
License: MIT License
Generate .strings files directly from your code
License: MIT License
See title
People familiar with other systems will almost immediately recognize this English-as-key approach as similar to gettext, a Unix translation facility from the late 1980s. Such a comparison will almost immediately raise a question: where is the plural facility?
If I am not mistaken, the current form of the python tool only generates strings
files, which has no capacity to handle plural stuff (NSStringPluralRuleType
). For truly international programs, this is often needed since plural rules vary widely among languages. Please consider putting plural support on your TODO list.
(Python has a builtin plistlib
library that makes dealing with plists less of a headache. You will still need to come up with a way to select the NSStringFormatValueTypeKey used for the plural though.)
I am trying to better understand the use-case for this library compared to the standard localisation workflow in Xcode.
In the readme you say:
LocalizedStringKit is a tool that lets you write English strings directly into your source code and generate the required .strings files later. No more manually managing string keys or remembering to add them to the strings file later. All you do is change:
label.text = NSLocalizedString("TERMS_SCREEN_MAIN_HEADER", "Comment here...")
...
If you use NSLocalizedString, you can write English strings directly into the source code as the key parameter (in the same way as with the replacement function in this library). Then to generate the strings files for the other languages, in Xcode,
Furthermore, If you alternatively use keys such as NSLocalizedString("my.string.a", ..), you can export the development language, in the same way as described above, and import to generate the strings file for the development language.
Is this library for when you don't use Xcode, or don't want to use the xliff-based workflow (for some reason)?
Thanks a lot for this library, I'd be interested to integrate it into my projects, but none of those use Carthage. It would be great if LocalizedStringKit supported SwiftPM, are there any plans for that?
We use regex for this and it's pretty buggy.
We can't use this for Objective-C, but we may be able to force Objective-C to call into Swift to get the localized strings it needs.
Looks like this library only generate "en.lproj" file. If the App supports more than 1 language, for example, Chinese, should we copy the en.lproj into zh-cn.lproj and update the strings files there?
My command:
localizedstringkit --exclude Carthage --path . --localized-string-kit-path ./LocalizedStringKit
Then the error is:
Found invalid calls to Localized in file Found invalid calls to Localized ./Carthage/Checkouts/localizedstringkit
My project directory looks like:
project root
- Carthage
- LocalizedStringKit
- LocalizedStringKit.bundle
Not sure what's wrong, but I have to use SPM to workaround this issue.
The default is English ,How can I use the language such as Japanese,Spanish, French
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.