FlineDev / BartyCrouch

Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

New issues after upgrade to latest version

MSlaski opened this issue · comments

Expected Behavior

Compiling without any warnings/errors

Actual Behavior

Two new warnings - one was solved, one still exist:

Solved one:
Could not parse syntax tree of Swift File
I solved it by adding path to supportedLanguageEnumPath from update.transform section

Not solved warning:
Could not find SupportedLanguage enum within BartyCrouch enum within path
I check few things at .bartycrouch.toml file but warning still occur

My toml file:

[update]
tasks = ["interfaces", "transform", "normalize"]

[update.interfaces]
paths = ["."]
defaultToBase = false
ignoreEmptyStrings = false
unstripped = false

[update.transform]
codePaths = ["."]
localizablePaths = ["."]
transformer = "swiftgenStructured"
supportedLanguageEnumPath = "GU1DE/SupportingFiles"
typeName = "BartyCrouch"
translateMethodName = "translate"

[update.normalize]
paths = ["."]
sourceLocale = "en"
harmonizeWithSource = true
sortByKeys = true

[lint]
paths = ["."]
duplicateKeys = true
emptyValues = true

Specifications

  • Version: latest
  • Platform: macOS Catalina 10.15.7
  • IDE Version: Xcode 12.0.1

BR
Mateusz

@MSlaski Thank you for reporting this. I can't reproduce your issue, it's all working for me, so could you please provide the exact command you're executing which causes the warning and could you also provide the full contents of the BartyCrouch enum file?

Hello @Jeehut

BartyCrouch enum:
enum BartyCrouch {
  enum SupportedLanguage: String {
    case english = "en"
    case polish = "pl"
  }

  static func translate(key: String, translations: [SupportedLanguage: String], comment: String? = nil) -> String {
    let typeName = String(describing: BartyCrouch.self)
    let methodName = #function

    print(
      "Warning: [BartyCrouch]",
      "Untransformed \(typeName).\(methodName) method call found with key '\(key)' and base translations '\(translations)'.",
      "Please ensure that BartyCrouch is installed and configured correctly."
    )

    // fall back in case something goes wrong with BartyCrouch transformation
    return "BC: TRANSFORMATION FAILED!"
  }
}

That warning appear when I trigger a project's build. It's fresh project and I don't have any code related to BartyCrouch on it, its my first attempt to use that pod and I configured it few weeks ago, all was working fine. Now im working on different stuff like CoreData, coordinators etc. So from my point of view nothing was changed around BartyCrouch

Use as a pod? Are you using CocoaPods for integrating BartyCrouch? Have you tried installing BartyCrouch via Homebrew and trying that way? Are you having the same issue? The enum file looks fine on first sight ... if you could provide a Demo project where I can reproduce this, it would be perfect. Given that you just setup a project, maybe you can upload a ZIP file for me? :) Feel free to send to my email address at github [at] cihatguendeuz [dot] de if you don't want to upload publicly.

I'm using CocoaPods for different frameworks, BartyCrouch was integrated via Homebrew. I will send my project to you via mail later :)

It's not possible to send it to provided mail address. Please, check attachment
project.zip

@MSlaski Thank you for providing the ZIP file. I've checked it out and immediately found the problem:

In your .bartycrouch.toml file you are pointing supportedLanguageEnumPath to the path GU1DE/SupportingFiles. But there is no such path. Your BartyCrouch.swift file lies under the path Supporting_Files instead, if you set the correct path, everything should work fine. At least I got the same warning as you got at first, but it disappeared once I set the correct path.

I'm closing this then as it's probably just a usage issue. I'll reopen if it still doesn't work for you and it happens to be a different problem. I hope this helps.

Hi,
Still not working for me. When I set a path to Supporting_Files I have two warnings:
Zrzut ekranu 2020-10-8 o 09 42 25

When I changed it to GU1DE/Supporting_Files still one warning is visible:
Zrzut ekranu 2020-10-8 o 09 44 08

Are you sure that you have the exact same project as you uploaded as a ZIP file? Can you try to run bartycrouch update via the command line in the GU1DE folder (folder where the .xcworkspace lies)? Do you get the same warning then? Can you also add the output of swift --version running from the command line?

Yes, im sure it is the same project

Zrzut ekranu 2020-10-8 o 11 27 56

iMac-Mateusz:GU1DE mat$ swift --version
Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
Target: x86_64-apple-darwin19.6.0

Ahh, there we go, please note the Releases Notes for version 4.3.0 stating this:

This version drops support for Xcode 11.x (or Swift 5.1/5.2), use BartyCrouch 4.2.0 in that case.

You might have installed Xcode 12.0.1 but it seems you don't have the command line tools of Xode 12 installed. Please make sure you have them installed which you can verify then easily with swift --version which should output Swift 5.3.

commented

@Jeehut hi, I have same issue, but for newest swift version

swift --version
swift-driver version: 1.26.9 Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)
Target: arm64-apple-macosx11.0

warning: BartyCrouch: Could not find 'SupportedLanguage' enum within 'BartyCrouch' enum within path.

can u suggest some workaround?