Comments (3)
Hello Victor,
Yes, you are absolutely correct with your understanding. Thought, I'd like to add two things that come from my experience (and you might have different one, but here is my piece):
Having keys / values in code is terrible when building huge projects. It is not on one place and therefore, maintenance is hell. Also, it goes against usual paradigms of other languages (see android, where you cannot even write a string into the code, you have to define it through XML).
Second thing is that by having plain keys on different places in the application, usually those will end up being in different formats (like "Profile.NavigationBar.X" and somewhere else you will find "Main Menu - Something").
This is especially hard to control when you have more people building one application. Also, it present problems with source control as the changes happen on many places at ones, you are changing basically whole files.
Personally, I think that genstrings tool has no place in Swift because swift allows you to strongly type almost everything and Laurine (or for Storyboards - Natalie) is the prime example of this.
I find this workflow the best:
- Create key / value in en.proj/.strings
- Add NSLocalizedString to code (or with Laurine, cmd+B and then add code)
- Once enough changes have been made or you want to translate to different language, upload to CrowdIn, and import remaining translations
Hope this gives you some insight how, and why :)
Have a nice day!
Jiri
from laurine.
As for removing NSLocalizedString with actual code, converter tool is coming probably within the month, that will do that for you (but it is quite complicated, so no promises on date yet.)
from laurine.
Thanks Jiri,
yes I'm aware of the maintenance nightmare of using string literals within the code, that's why I have all of them as constants/enums in a centralized file. But I could not use that approach for localization, as genstrings
is confused when not using actual strings.
I'm thinking I can always write code using NSLocalizedString
until it is working and tested, and then run genstrings
with the -a
modifier to append to the existing file, and then replace the calls to NSLocalizedString
with the Laurine-generated properties.
from laurine.
Related Issues (20)
- Compiled Script HOT 1
- Xcode 7.3 support HOT 5
- Support for dictionaries HOT 2
- Detect unused keys
- Deprecated homebrew dependencies HOT 3
- Swift 3 Support? HOT 18
- Can't build Laurine with Swift 2.2 on Mac Sierra HOT 2
- How to use this with many languages? HOT 1
- Laurine's younger Sister - Image Generator [name pending] HOT 2
- Generated Localizations file is incomplete if input file contains certain characters HOT 2
- Swift 4 migration HOT 2
- S3, S4 Support + Laurine Rework (announcement) HOT 9
- Question: What about memory? HOT 1
- Objc localization - String with format specifiers HOT 1
- Laurine fails at -d parameter HOT 1
- (Question) Fallback handling
- "Error.Title.General" is not recognized by Laurine
- "\\(variable)" not work HOT 1
- Feature request: use Base translation as comment
- Xcode 10.2 error HOT 20
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 laurine.