You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,13 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
31
31
### Security
32
32
- None.
33
33
34
+
## [4.14.0] - 2022-12-14
35
+
### Added
36
+
- Support for Swift 5.7 and Xcode 14, dropping support for older versions and fixing the 'could not parse syntax tree' issue.
37
+
- BartyCrouch now recognizes `LocalizedStringResource` entries by default (unless you override the `customFunction` option). This helps support localization in newer APIs like the AppIntents framework. See README for more info.
38
+
### Fixed
39
+
- Updated DeepL API to a POST request according to the documentation to fix issues.
40
+
34
41
## [4.13.0] - 2022-10-07
35
42
### Added
36
43
- Re-implement option `overrideComments` for code update (see README).
> There's [**now a new Mac app called RemafoX**](https://remafox.app?source=github.com.BartyCrouch) which is the _successor_ to BartyCrouch. It improves upon several aspects of BartyCrouch, such as having **no flaky dependencies**, adding **pluralization** support, **smart** machine translation, a built-in SwiftUI-compatible **enum generator**, built-in **step-by-step instructions** for easier setup, **detailed explanations** of all config options, and even [**a set of video guides**](https://www.youtube.com/watch?v=ObGIiWARjmw&list=PLvkAveYAfY4TLPtPd5jnqMwpAzY_pdxs5) for things like setup, key naming best practices and team onboarding. Get it for free [here](https://apps.apple.com/app/apple-store/id1605635026?pt=549314&ct=github.com.BartyCrouch&mt=8).
56
+
>
57
+
> Note that RemafoX is being **actively worked on**, you can even [vote for or request new features here](https://github.com/FlineDev/RemafoX/issues?q=is%3Aissue+label%3A%22Feature+Request%22+sort%3Areactions-%2B1-desc).
58
+
> In comparison, BartyCrouch is kept up-to-date mostly by the community.
59
+
60
+
53
61
# BartyCrouch
54
62
55
63
BartyCrouch **incrementally updates** your Strings files from your Code *and* from Interface Builder files. "Incrementally" means that BartyCrouch will by default **keep** both your already **translated values** and even your altered comments. Additionally you can also use BartyCrouch for **machine translating** from one language to 60+ other languages. Using BartyCrouch is as easy as **running a few simple commands** from the command line what can even be **automated using a [build script](#build-script)** within your project.
@@ -58,7 +66,7 @@ Checkout [this blog post](https://jeehut.medium.com/localization-in-swift-like-a
58
66
59
67
## Requirements
60
68
61
-
- Xcode 13.3+ & Swift 5.6+
69
+
- Xcode 14+ & Swift 5.7+
62
70
- Xcode Command Line Tools (see [here](http://stackoverflow.com/a/9329325/3451975) for installation instructions)
-`localizablePaths`: The enclosing path(s) containing the localized `Localizable.strings` files.
259
267
-`defaultToKeys`: Add new keys both as key and value.
260
268
-`additive`: Prevents cleaning up keys not found in code.
261
-
-`customFunction`: Use alternative name to `NSLocalizedString`.
269
+
-`customFunction`: Use alternative name to search for strings to localize, in addition to `NSLocalizedString`, and `CFCopyLocalizedString`. Defaults to `LocalizedStringResource`.
262
270
-`customLocalizableName`: Use alternative name for `Localizable.strings`.
263
271
-`unstripped`: Keeps whitespaces at beginning & end of Strings files.
264
272
-`plistArguments`: Use a plist file to store all the code files for the ExtractLocStrings tool. (Recommended for large projects.)
265
273
-`ignoreKeys`: Keys (e.g. in the comment) indicating that specific translation entries should be ignored when generating String files.
266
-
-`overrideComments`: Always overrides the comment with the keys new translation, useful for IB files.
274
+
-`overrideComments`: Always overrides the comment with the keys new translation, useful for IB files.
NOTE: As of version 4.x of BartyCrouch *formatted* localized Strings are not supported by this automatic feature.
357
365
366
+
### Localizing strings of `LocalizableStringResource` type (AppIntents, ...)
367
+
368
+
Historically, Apple platforms used `CFCopyLocalizedString`, and `NSLocalizedString` macros and their variants, to mark strings used in code to be localized, and to load their localized versions during runtime from `Localizable.strings` file.
369
+
370
+
Since introduction of the AppIntents framework, the localized strings in code can also be typed as `LocalizedStringResource`, and are no longer marked explicitly.
371
+
372
+
Let's examine this snippet of AppIntents code:
373
+
374
+
```
375
+
struct ExportAllTransactionsIntent: AppIntent {
376
+
static var title: LocalizedStringResource = "Export all transactions"
377
+
378
+
static var description =
379
+
IntentDescription("Exports your transaction history as CSV data.")
380
+
}
381
+
```
382
+
383
+
In the example above, both the `"Export all transactions"`, and `"Exports your transaction history as CSV data."` are actually `StaticString` instances that will be converted during compilation into `LocalizedStringResource` instances, and will lookup their respective localizations during runtime from `Localized.strings` file the same way as when using `NSLocalizedString` in the past. The only exception being that such strings are not marked explicitly, and require swift compiler to parse and extract such strings for localization. This is what Xcode does from version 13 when using `Product -> Export Localizations...` option.
384
+
385
+
In order to continue translating these strings with `bartycrouch` it is required to mark them explicitely with `LocalizedStringResource(_: String, comment: String)` call, and specify `customFunction="LocalizedStringResource"` in `code` task options.
386
+
387
+
The example AppIntents code that can be localized with `bartycrouch` will look like this:
388
+
389
+
```
390
+
struct ExportAllTransactionsIntent: AppIntent {
391
+
static var title = LocalizedStringResource("Export all transactions", comment: "")
392
+
393
+
static var description =
394
+
IntentDescription(LocalizedStringResource("Exports your transaction history as CSV data.", comment: ""))
395
+
}
396
+
```
397
+
398
+
Note that you must use the full form of `LocalizedStringResource(_: StaticString, comment: StaticString)` for the `bartycrouch`, or more specifically for the `extractLocStrings` (see `xcrun extractLocStrings`) to properly parse the strings.
399
+
358
400
### Build Script
359
401
360
402
In order to truly profit from BartyCrouch's ability to update & lint your `.strings` files you can make it a natural part of your development workflow within Xcode. In order to do this select your target, choose the `Build Phases` tab and click the + button on the top left corner of that pane. Select `New Run Script Phase` and copy the following into the text box below the `Shell: /bin/sh` of your new run script phase:
@@ -426,6 +468,11 @@ See the file [MIGRATION_GUIDES.md](https://github.com/FlineDev/BartyCrouch/blob/
426
468
427
469
Contributions are welcome. Feel free to open an issue on GitHub with your ideas or implement an idea yourself and post a pull request. If you want to contribute code, please try to follow the same syntax and semantic in your **commit messages** (see rationale [here](http://chris.beams.io/posts/git-commit/)). Also, please make sure to add an entry to the `CHANGELOG.md` file which explains your change.
428
470
471
+
In order for the tests to run build issues, you need to run – also add an an API key in the new file to run the translations tests, too:
0 commit comments