FlineDev/BartyCrouch

Translate Causing Fatal Error

thecoolwinter opened this issue · 3 comments

Expected Behavior

I'd like to use the machine translation feature of BartyCrouch. I have 'update.translate' configured in my .bartycrouch.toml file.

Actual Behavior

Whenever I run bartycrouch update in the terminal it runs through each phase of the update, then hits a fatal error on translate. The error when running with -v -x is:

Starting Task 'Translate' ...
info: BartyCrouch:  Translated file '/Users/.../Controllers/de.lproj/Main.strings' with 0 changes.
info: BartyCrouch:  Translated file '/Users/.../Controllers/zh-Hans.lproj/Main.strings' with 0 changes.
error: BartyCrouch:  The operation couldn’t be completed. (MungoHealer.MungoFatalError error 1.)

My .toml file looks like:

[update]
tasks = ["interfaces", "code", "translate", "normalize"]

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

[update.code]
codePaths = ["."]
localizablePaths = ["."]
defaultToKeys = false
additive = true
unstripped = false
plistArguments = true

[update.transform]
codePaths = ["."]
localizablePaths = ["."]
transformer = "foundation"
supportedLanguageEnumPath = "."
typeName = "BartyCrouch"
translateMethodName = "translate"

[update.translate]
paths = "."
secret = "<Excluded, I have made sure my key is working using curl>"
sourceLocale = "en"

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

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

My .strings files look like this:
Screen Shot 2020-05-24 at 1 51 39 PM
Each is encoded using UTF-8

Specifications

  • Version: 4.2.0
  • Platform: MacOS - installed from brew

I've solved it now, I ended up writing my own script to do the translation.

@thecoolwinter Hi, I'm sorry that this happened and you needed to write your own script. I haven't used the translate option in any project for a while now so I'm not sure if there are any changes in API or similar. But tests seem to be passing, one thing I can see from your toml file is that you haven't configured the path properties to point to something more specific than . which might match too many files depending on your project files.

Maybe there was some file you didn't expect in some other directly that confuses BartyCrouch? Can you try setting path to something more specific, at least for the translate config?

0xJxa commented

I've solved it now, I ended up writing my own script to do the translation.

@thecoolwinter would you mind sharing your script for the translation, please?