FlineDev / BartyCrouch

Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files.
MIT License
1.36k stars 120 forks source link

XLIFF export considering #bc-ignore! #195

Open futuretap opened 4 years ago

futuretap commented 4 years ago

Problem Statement

Xcode's builtin "Export for Localization…" XLIFF export includes IB views marked with #bc-ignore!.

Suggested Solution

bartycrouch export-xliff

Example Usage

bartycrouch export-xliff <destination-dir> <languages>

destination-dir: optional, defaults to . languages: comma-separated list of language codes; optional, defaults to proj languages.

The exported format should be identical to Xcode's builtin export except that it ignores #bc-ignore! views.

Possible Involvement

lechuckcaptain commented 4 years ago

I had the same issue and after a couple of days of searching what's the best option available I found this nice hack:

https://stackoverflow.com/a/46991397/355465

Basically for terms ignored using the standard BartyCrouch notation #bc-ignore! you just need to launch the following command:

xmlstarlet ed -d "//*[contains(text(), 'Note = \"#bc-ignore')]/.." en.xliff > en_clean.xliff

I'm currently testing it in details and I'll keep the issue updated.

In any case it would be nice to have this feature somewhat available directly inside BartyCrouch, since it seems that we cannot trust Apple for having in Xcode 🤔

FlineDevPublic commented 2 years ago

@futuretap Thank you for reporting this feature request and sorry for answering so late. Maybe you don't have this issue anymore, but others may want the same thing, too, so let me share my thoughts on this:

In general I'm not sure if I want to bloat up BartyCrouch to be a tool that does everything related to localization. It was always meant to just fix the "missing parts" in Xcode, it's more like a feature filler. But I like the approach mentioned by @lechuckcaptain which can be done either with the command he shared above or we could actually also add a feature that does this change right within BartyCrouch, so you don't have to mess with another language or tool.

But as there's the above workaround, that's not top of my list of smaller features to add to BartyCrouch. I might consider it though sometime in the future. In any case if somebody wanted to add such a feature, I'm also happy to review good PRs. :)


This comment was written during my regular Open Source live stream on Twitch. Follow me there to support my work!