Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate-localization-file include only strings without tags #291

Open
nuke-dash opened this issue Oct 7, 2019 · 3 comments
Open

generate-localization-file include only strings without tags #291

nuke-dash opened this issue Oct 7, 2019 · 3 comments

Comments

@nuke-dash
Copy link

I have a twine file with keys containing no tags and keys containing tags.
e.g.

twine example
[[Guest Mode]]
    [guestMode_unavailable_on_guest_mode_popup_cancel_action]
        en = Cancel
        comment = Confirmation popup action "Cancel" to continue in guest mode
        sl = Cancel
[[Permissions]]
    [NSBluetoothAlwaysUsageDescription]
        en = ${PRODUCT_NAME} uses Bluetooth to discover nearby Cast devices.
        comment = iOS message shown to the user when using chomecast device discovery. PRODUCT_NAME is the name of the app
        tags = infoplist
        sl = ${PRODUCT_NAME} uses Bluetooth to discover nearby Cast devices.

I can't seem to get only the strings without tags.
Getting only the infoPlist strings works with the following command:
twine generate-localization-file ./twine.txt ./test.strings --lang en --format apple --tags infoplist

But using ~infoplist doesn't work
$ twine generate-localization-file ./twine.txt ./test.strings --lang en --format apple --tags ~infoplist
zsh: no such user or named directory: infoplist

Wrapping it inside double quotes also doesn't work
$ twine generate-localization-file ./twine.txt ./test.strings --lang en --format apple --tags "~infoplist"
Nothing to generate! The resulting file would not contain any translations.

Is it perhaps required that all field have tags when working with --tags?
As I noticed that when I add the tag "common" to one of the strings without tags the command succeeds when using double quotes and contains only the one string.
But I would expect it to also include the strings without tags.

@scelis
Copy link
Owner

scelis commented Oct 11, 2019

Hello! Have you tried the --untagged option?

twine generate-localization-file ./twine.txt ./test.strings --lang en --format apple --untagged

@nuke-dash
Copy link
Author

nuke-dash commented Oct 11, 2019

Thanks, I didn't knew that existed, the docs don't mention it.
But unfortunately it doesn't seem to be working.
It seems to also include strings with tags

$twine generate-localization-file ./twine.txt ./test.strings --lang en --format apple --untagged 
$cat ./test.strings
/**
 * Apple Strings File
 * Generated by Twine 1.0.6
 * Language: en
 */

/********** Guest Mode **********/

/* Confirmation popup action "Cancel" to continue in guest mode */
"guestMode_unavailable_on_guest_mode_popup_cancel_action" = "Cancel";


/********** Permissions **********/

/* iOS message shown to the user when using chomecast device discovery. PRODUCT_NAME is the name of the app */
"NSBluetoothAlwaysUsageDescription" = "${PRODUCT_NAME} uses Bluetooth to discover nearby Cast devices.";

@scelis
Copy link
Owner

scelis commented Oct 11, 2019

A ha! Sorry, it's not super clear.

--tags is used to select tags you want, but if you don't specify anything twine assumes you want all tags (but not strings that are untagged)

--untagged is used to also select strings that are untagged

If you only specify untagged you get everything. Tagged and untagged.

So you really want to specify NO tag. Or a tag that doesn't exist. As well as untagged. So either of these should theoretically work:

twine generate-localization-file ./twine.txt ./test.strings --lang en --format apple --untagged --tags=""

twine generate-localization-file ./twine.txt ./test.strings --lang en --format apple --untagged --tags=AN_INVALID_TAG

I definitely think we could do something here to make this better and/or more obvious.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants