FlineDev / BartyCrouch

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

Translate successful but no output for Storyboards Main.string file #252

Closed MarinaHuber closed 2 years ago

MarinaHuber commented 2 years ago

Expected Behavior

When building script and using translate, I would expect to see some Croatian translations for the Main.string I am NOT using "code" and Localizable.string but just plain user-facing text in Main.string for testing purposes Also when running Azure api all works with GLOBAL region:

> curl -X POST "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to=hr" \
>      -H "Ocp-Apim-Subscription-Key: <KEY-FROM-TRANSLATOR>" \
>      -H "Content-Type: application/json" \
>      -d "[{'Text':'Hello, what is your name?'}]"

Actual Behavior

Script runs success but no translate, and no idea how to debug it. /Users/user/Desktop/stuff/Whats-the-SkyCast/WeatherOnTheMap/Supporting files/en.lproj/Main.strings: success: BartyCrouch: Successfully translated 0 values in 0 files.

Screenshot 2022-05-19 at 08 54 53

Steps to Reproduce the Problem

  1. File .toml looks pretty basic but I did play with paths for the translate config

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

[update.interfaces] paths = ["."] subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"] defaultToBase = false ignoreEmptyStrings = false unstripped = false ignoreKeys = ["#bartycrouch-ignore!", "#bc-ignore!", "#i!"]

[update.code] codePaths = ["."] subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"] localizablePaths = ["."] defaultToKeys = false additive = true unstripped = false plistArguments = true ignoreKeys = ["#bartycrouch-ignore!", "#bc-ignore!", "#i!"]

[update.transform] codePaths = ["."] subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"] localizablePaths = ["."] transformer = "foundation" supportedLanguageEnumPath = "." typeName = "BartyCrouch" translateMethodName = "translate"

[update.normalize] paths = ["."] subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"] sourceLocale = "en" harmonizeWithSource = true sortByKeys = true

[lint] paths = ["."] subpathsToIgnore = [".git", "carthage", "pods", "build", ".build", "docs"] duplicateKeys = true emptyValues = true

[update.translate] paths = ["WeatherOnTheMap/Supporting files"] translator = "microsoftTranslator" secret = "Key-From-Translator" sourceLocale = "en"

Is there something I can configure for only storyboard .strings that I am missing? I couldn't find it in the Issues or on web.

Specifications

Jeehut commented 2 years ago

@MarinaHuber Thank you for reporting this issue. To help you, I need more information. Can you send me a screenshot of your file structure, including the Main.strings file in the language you expect it to be translated to and the Main.strings file in the source language en. Also, have you tried translating to other languages or is Croatian the only other language you have set up? That would help to know if its an issue with the language specifically, your file structure or the tool

MarinaHuber commented 2 years ago

@Jeehut thank you for reaching out! here is the slightly different set-up and is working this "Hello world" project with the custom .toml file. I would say my Spanish Localizable.strings file did not have all "" empty strings but they were default English, when deleted the translation worked. Please close this Issue 👍 Nevertheless I was wandering about all there erros I get when using @Designables that I would really like to use for all the Storyboard elements. - how can I skip/improve that? bad entry in file

translations-demo.zip

FlineDevPublic commented 2 years ago

@MarinaHuber I just had a look at this during my stream and explained in detail why those warnings or errors are being shown. I'll link to the exact time code later, but in short, those errors come from an Apple tool, not from BartyCrouch. And neither Apple nor I can fix the root cause. But to remove the errors, you can simply exclude the subpath "Helpers" from the [update.code] task, see here: Screen Shot 2022-05-27 at 17 03 20

Closing this as you already stated you could solve it yourself.


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