Skip to content

Commit

Permalink
Merge branch 'release/4.11.0' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
FlineDevPublic committed May 27, 2022
2 parents 8e12d83 + 7f79308 commit 31c4cb2
Show file tree
Hide file tree
Showing 19 changed files with 173 additions and 142 deletions.
2 changes: 1 addition & 1 deletion BartyCrouch.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "BartyCrouch"
s.version = "4.10.0"
s.version = "4.11.0"
s.summary = "Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files."

s.description = <<-DESC
Expand Down
82 changes: 45 additions & 37 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Formula/bartycrouch.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Bartycrouch < Formula
desc "Incrementally update/translate your Strings files"
homepage "https://github.com/Flinesoft/BartyCrouch"
url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.10.0", :revision => "0ab7e7eae5549439026676c730584846f1bc515a"
url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.10.2", :revision => "8e12d831b2cb84c05c94a715815139e76f6a7b64"
head "https://github.com/Flinesoft/BartyCrouch.git"

depends_on :xcode => ["13.3", :build]
Expand Down
41 changes: 21 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
<p align="center">
<img src="https://raw.githubusercontent.com/Flinesoft/BartyCrouch/main/Logo.png" width=600>
<img src="https://raw.githubusercontent.com/FlineDev/BartyCrouch/main/Logo.png" width=600>
</p>

<p align="center">
<a href="https://github.com/Flinesoft/BartyCrouch/actions?query=workflow%3ACI+branch%3Amain">
<img src="https://github.com/Flinesoft/BartyCrouch/workflows/CI/badge.svg?branch=main"
<a href="https://github.com/FlineDev/BartyCrouch/actions?query=workflow%3ACI+branch%3Amain">
<img src="https://github.com/FlineDev/BartyCrouch/workflows/CI/badge.svg?branch=main"
alt="CI Status">
</a>
<a href="https://www.codacy.com/gh/Flinesoft/BartyCrouch">
<a href="https://www.codacy.com/gh/FlineDev/BartyCrouch">
<img src="https://api.codacy.com/project/badge/Grade/7b34ad9193c2438aa32aa29a0490451f"/>
</a>
<a href="https://www.codacy.com/gh/Flinesoft/BartyCrouch">
<a href="https://www.codacy.com/gh/FlineDev/BartyCrouch">
<img src="https://api.codacy.com/project/badge/Coverage/7b34ad9193c2438aa32aa29a0490451f"/>
</a>
<a href="https://github.com/Flinesoft/BartyCrouch/releases">
<img src="https://img.shields.io/badge/Version-4.10.2-blue.svg"
alt="Version: 4.10.2">
<a href="https://github.com/FlineDev/BartyCrouch/releases">
<img src="https://img.shields.io/badge/Version-4.11.0-blue.svg"
alt="Version: 4.11.0">
</a>
<img src="https://img.shields.io/badge/Swift-5.6-FFAC45.svg"
alt="Swift: 5.6">
<a href="https://github.com/Flinesoft/BartyCrouch/blob/main/LICENSE.md">
<a href="https://github.com/FlineDev/BartyCrouch/blob/main/LICENSE.md">
<img src="https://img.shields.io/badge/License-MIT-lightgrey.svg"
alt="License: MIT">
</a>
Expand All @@ -45,7 +45,7 @@
• <a href="#build-script">Build Script</a>
• <a href="#donation">Donation</a>
• <a href="#migration-guides">Migration Guides</a>
• <a href="https://github.com/Flinesoft/BartyCrouch/issues">Issues</a>
• <a href="https://github.com/FlineDev/BartyCrouch/issues">Issues</a>
• <a href="#contributing">Contributing</a>
• <a href="#license">License</a>
</p>
Expand Down Expand Up @@ -87,7 +87,7 @@ brew upgrade bartycrouch
To **install** or update to the latest version of BartyCrouch simply run this command:

```bash
mint install Flinesoft/BartyCrouch
mint install FlineDev/BartyCrouch
```
</details>

Expand Down Expand Up @@ -154,7 +154,7 @@ This is the default configuration of BartyCrouch and should work for most projec

```swift
// This file is required in order for the `transform` task of the translation helper tool BartyCrouch to work.
// See here for more details: https://github.com/Flinesoft/BartyCrouch
// See here for more details: https://github.com/FlineDev/BartyCrouch

import Foundation

Expand Down Expand Up @@ -200,6 +200,7 @@ enum BartyCrouch {
```toml
[update.translate]
paths = "."
translator = "microsoftTranslator"
secret = "<#Subscription Key#>"
sourceLocale = "en"
```
Expand Down Expand Up @@ -275,6 +276,7 @@ tasks = ["interfaces", "code", "transform", "normalize"]
- `typeName`: The name of the type enclosing the `SupportedLanguage` enum and translate method.
- `translateMethodName`: The name of the translate method to be replaced.
- `customLocalizableName`: Use alternative name for `Localizable.strings`.
- `separateWithEmptyLine`: Set to `false` if you don't want to have empty lines between Strings entries. Defaults to `true.

</details>

Expand All @@ -285,6 +287,7 @@ tasks = ["interfaces", "code", "transform", "normalize"]
- `translator`: Specifies the translation API. Use `microsoftTranslator` or `deepL`.
- `secret`: Your [Microsoft Translator Text API Subscription Key](https://docs.microsoft.com/en-us/azure/cognitive-services/translator/translator-text-how-to-signup#authentication-key) or [Authentication Key for DeepL API](https://www.deepl.com/pro-account/plan).
- `sourceLocale`: The source language to translate from.
- `separateWithEmptyLine`: Set to `false` if you don't want to have empty lines between Strings entries. Defaults to `true.

</details>

Expand All @@ -295,6 +298,7 @@ tasks = ["interfaces", "code", "transform", "normalize"]
- `sourceLocale`: The source language to harmonize keys of other languages with.
- `harmonizeWithSource`: Synchronizes keys with source language.
- `sortByKeys`: Alphabetically sorts translations by their keys.
- `separateWithEmptyLine`: Set to `false` if you don't want to have empty lines between Strings entries. Defaults to `true.

</details>

Expand Down Expand Up @@ -355,11 +359,13 @@ NOTE: As of version 4.x of BartyCrouch *formatted* localized Strings are not sup
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:

```shell
export PATH="$PATH:/opt/homebrew/bin"

if which bartycrouch > /dev/null; then
bartycrouch update -x
bartycrouch lint -x
else
echo "warning: BartyCrouch not installed, download it from https://github.com/Flinesoft/BartyCrouch"
echo "warning: BartyCrouch not installed, download it from https://github.com/FlineDev/BartyCrouch"
fi
```

Expand Down Expand Up @@ -404,21 +410,16 @@ func updateTimeLabel(minutes: Int) {

The `%d minute(s) ago` key will be taken from Localizable.stringsdict file, not from Localizable.strings, that's why it should be ignored by BartyCrouch.

### Things to Know:

- Files named or files in folders named ".git", "carthage", "pods", "build",
".build" and "docs" (case insensitive) will always be ignored.


## Donation

BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please **make a small donation on [PayPal](https://paypal.me/Dschee/5EUR)**. In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by **becoming a sponsor on [GitHub](https://github.com/sponsors/Jeehut)** or a **patron on [Patreon](https://www.patreon.com/Jeehut)**.
BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please **make a small donation on [PayPal](https://paypal.me/Dschee/5EUR)**. In case you also like my other [open source contributions](https://github.com/FlineDev) and [articles](https://medium.com/@Jeehut), please consider motivating me by **becoming a sponsor on [GitHub](https://github.com/sponsors/Jeehut)** or a **patron on [Patreon](https://www.patreon.com/Jeehut)**.

Thank you very much for any donation, it really helps out a lot! 💯

## Migration Guides

See the file [MIGRATION_GUIDES.md](https://github.com/Flinesoft/BartyCrouch/blob/main/MIGRATION_GUIDES.md).
See the file [MIGRATION_GUIDES.md](https://github.com/FlineDev/BartyCrouch/blob/main/MIGRATION_GUIDES.md).

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion Sources/BartyCrouch/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SwiftCLI
// MARK: - CLI
let cli = CLI(
name: "bartycrouch",
version: "4.10.2",
version: "4.11.0",
description: "Incrementally update & translate your Strings files from code or interface files."
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ public struct NormalizeOptions {
public let sourceLocale: String
public let harmonizeWithSource: Bool
public let sortByKeys: Bool
public let separateWithEmptyLine: Bool
}

extension NormalizeOptions: TomlCodable {
Expand All @@ -20,18 +21,20 @@ extension NormalizeOptions: TomlCodable {
subpathsToIgnore: toml.array(update, normalize, "subpathsToIgnore") ?? Constants.defaultSubpathsToIgnore,
sourceLocale: toml.string(update, normalize, "sourceLocale") ?? "en",
harmonizeWithSource: toml.bool(update, normalize, "harmonizeWithSource") ?? true,
sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true
sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true,
separateWithEmptyLine: toml.bool(update, normalize, "separateWithEmptyLine") ?? true
)
}

func tomlContents() -> String {
var lines: [String] = ["[update.normalize]"]

lines.append("paths = \(paths)")
lines.append("subpathsToIgnore = \(subpathsToIgnore)")
lines.append("sourceLocale = \"\(sourceLocale)\"")
lines.append("harmonizeWithSource = \(harmonizeWithSource)")
lines.append("sortByKeys = \(sortByKeys)")
lines.append("paths = \(self.paths)")
lines.append("subpathsToIgnore = \(self.subpathsToIgnore)")
lines.append("sourceLocale = \"\(self.sourceLocale)\"")
lines.append("harmonizeWithSource = \(self.harmonizeWithSource)")
lines.append("sortByKeys = \(self.sortByKeys)")
lines.append("separateWithEmptyLine = \(self.separateWithEmptyLine)")

return lines.joined(separator: "\n")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public struct TransformOptions {
public let typeName: String
public let translateMethodName: String
public let customLocalizableName: String?
public let separateWithEmptyLine: Bool
}

extension TransformOptions: TomlCodable {
Expand Down Expand Up @@ -43,25 +44,28 @@ extension TransformOptions: TomlCodable {
supportedLanguageEnumPath: toml.string(update, transform, "supportedLanguageEnumPath") ?? ".",
typeName: toml.string(update, transform, "typeName") ?? "BartyCrouch",
translateMethodName: toml.string(update, transform, "translateMethodName") ?? "translate",
customLocalizableName: toml.string(update, transform, "customLocalizableName")
customLocalizableName: toml.string(update, transform, "customLocalizableName"),
separateWithEmptyLine: toml.bool(update, transform, "separateWithEmptyLine") ?? true
)
}

func tomlContents() -> String {
var lines: [String] = ["[update.transform]"]

lines.append("codePaths = \(codePaths)")
lines.append("subpathsToIgnore = \(subpathsToIgnore)")
lines.append("localizablePaths = \(localizablePaths)")
lines.append("transformer = \"\(transformer.rawValue)\"")
lines.append("supportedLanguageEnumPath = \"\(supportedLanguageEnumPath)\"")
lines.append("typeName = \"\(typeName)\"")
lines.append("translateMethodName = \"\(translateMethodName)\"")
lines.append("codePaths = \(self.codePaths)")
lines.append("subpathsToIgnore = \(self.subpathsToIgnore)")
lines.append("localizablePaths = \(self.localizablePaths)")
lines.append(#"transformer = "\#(self.transformer.rawValue)""#)
lines.append(#"supportedLanguageEnumPath = "\#(self.supportedLanguageEnumPath)""#)
lines.append(#"typeName = "\#(self.typeName)""#)
lines.append(#"translateMethodName = "\#(self.translateMethodName)""#)

if let customLocalizableName = customLocalizableName {
lines.append("customLocalizableName = \"\(customLocalizableName)\"")
lines.append(#"customLocalizableName = "\#(customLocalizableName)""#)
}

lines.append("separateWithEmptyLine = \(self.separateWithEmptyLine)")

return lines.joined(separator: "\n")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public struct TranslateOptions {
public let subpathsToIgnore: [String]
public let secret: Secret
public let sourceLocale: String
public let separateWithEmptyLine: Bool
}

extension TranslateOptions: TomlCodable {
Expand All @@ -21,10 +22,11 @@ extension TranslateOptions: TomlCodable {
let translate: String = "translate"

if let secretString: String = toml.string(update, translate, "secret") {
let translator = toml.string(update, translate, "translator") ?? ""
let translator = toml.string(update, translate, "translator") ?? "microsoftTranslator"
let paths = toml.filePaths(update, translate, singularKey: "path", pluralKey: "paths")
let subpathsToIgnore = toml.array(update, translate, "subpathsToIgnore") ?? Constants.defaultSubpathsToIgnore
let sourceLocale: String = toml.string(update, translate, "sourceLocale") ?? "en"
let separateWithEmptyLine = toml.bool(update, translate, "separateWithEmptyLine") ?? true
let secret: Secret
switch Translator(rawValue: translator) {
case .microsoftTranslator, .none:
Expand All @@ -38,7 +40,8 @@ extension TranslateOptions: TomlCodable {
paths: paths,
subpathsToIgnore: subpathsToIgnore,
secret: secret,
sourceLocale: sourceLocale
sourceLocale: sourceLocale,
separateWithEmptyLine: separateWithEmptyLine
)
}
else {
Expand All @@ -56,13 +59,14 @@ extension TranslateOptions: TomlCodable {
lines.append("subpathsToIgnore = \(subpathsToIgnore)")
switch secret {
case let .deepL(secret):
lines.append("secret = \"\(secret)\"")
lines.append(#"secret = "\#(secret)""#)

case let .microsoftTranslator(secret):
lines.append("secret = \"\(secret)\"")
lines.append(#"secret = "\#(secret)""#)
}

lines.append("sourceLocale = \"\(sourceLocale)\"")
lines.append(#"sourceLocale = "\#(sourceLocale)""#)
lines.append("separateWithEmptyLine = \(self.separateWithEmptyLine)")

return lines.joined(separator: "\n")
}
Expand Down
Loading

0 comments on commit 31c4cb2

Please sign in to comment.