Git Product home page Git Product logo

Comments (11)

Jeehut avatar Jeehut commented on May 21, 2024 1

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.

Jeehut avatar Jeehut commented on May 21, 2024 1

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.

Jeehut avatar Jeehut commented on May 21, 2024 1

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.

Jeehut avatar Jeehut commented on May 21, 2024 1

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.

kafejo avatar kafejo commented on May 21, 2024

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.

Jeehut avatar Jeehut commented on May 21, 2024

@kafejo That should be the current behavior though, are you sure it's not the case for you?

from bartycrouch.

kafejo avatar kafejo commented on May 21, 2024

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.

Jeehut avatar Jeehut commented on May 21, 2024

@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.

kafejo avatar kafejo commented on May 21, 2024

Nice. I will take a look at it.

from bartycrouch.

Jeehut avatar Jeehut commented on May 21, 2024

@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.

kafejo avatar kafejo commented on May 21, 2024

Cool! Thanks! 🎉

from bartycrouch.

Related Issues (20)

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.