Comments (11)
I'm sorry, I still don't get it. What's sorted about those keys in your example? As far as I can see advert-detail.no-advert-error
(lets call it A) appears first, then there's a user-profile.no-user
key in between (B) and further down there is advert-administration.advert-does-not-exist
(C).
If those keys were sorted then the order would need to be: C-A-B. But if the quoted file is the result of BartyCrouch then it's clearly not sorting by anything, instead it's just adding new ones as it should.
Btw: I think the best way to explain any odd behavior you wouldn't expect is to fork BartyCrouch, add a new test case that reproduces the unexpected behavior and send it in as a pull request marked as [WIP]
(work in progress). This way I would both understand it and also have a test that could make sure an implementation of the feature actually does the right thing. :)
from bartycrouch.
I just happened to come across this same issue in a project where PhraseApp is used. Gonna investigate this and report once I have results.
from bartycrouch.
I just implemented this feature and released a new version with it – use the -s
(sort-by-keys) option to sort your files by their keys starting with version 3.5.0. 🎉
from bartycrouch.
Please note that I just released version 3.5.1 which changes the behavior of the sort-by-keys option slightly: It sorts entries with empty translations to the end so untranslated keys can be easily found as expected. Another run of BartyCrouch after translating the keys will sort them correctly. I think this is gonna make this option much more useful in practice! :)
from bartycrouch.
I would also consider time sort option - it means that new strings will be added at the end. Because I often find myself searching through the localizable file to find a new key I've just added.
from bartycrouch.
@kafejo That should be the current behavior though, are you sure it's not the case for you?
from bartycrouch.
Actually I've examined it and current behaviour sorts it by key! Strange 😅
from our strings file:
…
/* No advert present. */
"advert-detail.no-advert-error" = "The advert does not exist.";
/* Reissue action button title of advert peek preview */
"advert-preview.actions.sold" = "Reissue advert";
/* The user does not exist. */
"user-profile.no-user" = "The user does not exist.";
/* Camera */
"action-sheet.camera" = "Take photo";
/* Choose option */
"action-sheet.choose-option" = "Choose option";
/* Library */
"action-sheet.library" = "Photo library";
/* Will ship */
"adver.will-ship" = "Will ship";
/* Advert does not exist. */
"advert-administration.advert-does-not-exist" = "Advert does not exist.";
/* Restricted camera access */
"advert-administration.camera-access-restricted" = "Camera access for this user is restricted.";
…
We use Bartycrouch run script in aggregated target
if [ $CONFIGURATION == Debug ]; then
if which bartycrouch > /dev/null; then
# Incrementally update all Storyboards/XIBs strings files
bartycrouch interfaces -p "$PROJECT_DIR"
# Add new keys to Localizable.strings files from NSLocalizedString in code
bartycrouch code -p "$PROJECT_DIR/maarked" -l "$PROJECT_DIR" -a
else
echo "warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch"
fi
fi
from bartycrouch.
@kafejo I have just added a simple test in fa9739d to reproduce the issue we both have come across but without success. I expected the test to fail as we have both seen such a thing happen but it didn't – the new key was added at the end of the file.
I also copied the entire Localizable.strings
over from the project where I had seen this issue – still the new key was added at the end, like expected. I think now that the test is setup you can easily alter the existing Localizable.strings
file and/or the SwiftExample3.swift
file(s) until you succeed in reproducing this issue. Once we know what the problem is we can fix it.
from bartycrouch.
Nice. I will take a look at it.
from bartycrouch.
@kafejo I just found the issue with the reordering of existing keys and fixed it – just update to version 3.3.5 to see for yourself. I hope that fixes your issue! :)
from bartycrouch.
Cool! Thanks! 🎉
from bartycrouch.
Related Issues (20)
- Can't build project after upgrade bartycrouch to 4.8.0
- Explicit folders on the `codePaths` argument shouldn't be ignored later. HOT 5
- NSLocationTemporaryUsageDescriptionDictionary translations gets removed HOT 6
- Cocoapods executable doesn't work on x86 machines HOT 19
- Embed lib_InternalSwiftSyntaxParser.dylib into package HOT 3
- error: the target 'SwiftSyntax' in product 'SwiftSyntax' contains unsafe build flags HOT 4
- Support for none default Xcode install path HOT 1
- Add new line on every translation after normalize HOT 2
- Translate successful but no output for Storyboards Main.string file HOT 3
- BartyCrouch with SwiftGen creates empty string values HOT 2
- [Feat] Autogenerate `.strings` files HOT 3
- `overrideComments` option doesn't work HOT 4
- [Bug] CI failed for version 4.12.0 HOT 2
- [Bug] update.code with additive=false and code in multiple parent directories looses strings HOT 5
- [Feat] Tip: How to localize LocalizedStringResource types with bartycrouch HOT 3
- [Feat] Support for modular application HOT 4
- [Bug] Translation Microya.ApiError<Microya.EmptyBodyResponse> error 3 HOT 2
- [Bug] PodSpec does not support iOS anymore HOT 7
- [Feat] Extract localizable Strings from SwiftUI Text HOT 1
- [Question/Bug] : .bartycrouch.toml permission errors on dependent test build HOT 7
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 bartycrouch.