Closed dumazy closed 6 months ago
Hello, i have the same issue
I noticed that the response often contains some text before the JSON file structure.
For example:
'''
arb
{
"certificates": "Certificates"
}
'''
or
'''
json
{
"certificates": "Certificates"
}
'''
Can you add a function that will correctly extract the JSON?
Even such a simple improvement makes a significant difference.
String _extractJson(String response) {
int startIndex = response.indexOf('{');
int endIndex = response.lastIndexOf('}');
return response.substring(startIndex, endIndex + 1);
}
I've also noticed that sometimes the response has an incorrect JSON format, for example, missing commas like in the attachment.
...but it's ok that it trying to retrieve the response again.
I'm seeing the same, I first tried it on 0.1.2
which used to work fine and then upgraded to 0.1.3
to see if it fixed it, so I don't think it's something introduced with 0.1.3
and more likely a change in the response coming back from gemini
Thanks for reporting. I will look into making error handling more advanced and robust
Hey! I can also confirm this issue, happens constantly. I hope this will be fixed soon, it's a great tool otherwise, but currently the usage is quite frustrating.
Same here! it's a pity that I can't use this tool anymore.
Yep, seems like this was caused by a change in Gemini. What's interesting Vertex AI and standard Gemini API seem to behave a bit differently in this case. The Gemini API was returning a correct result more often. Either way I've added the solution proposed by @m1n093 and an instruction in the prompt to return only JSON and this should solve most of the problems. Check out the new version 0.1.4
Hello!
arb_translate: ^1.0.0
Do a Git commit: https://github.com/calcitem/Sanmill/commit/1a91f224b22ffd26224fba1e4cedf403cad923e8
And then run arb_translate
.
Error Message:
Translating 1 terms for locale af...
Instance of 'NoResponseException'
Placeholder validation failed for batch 1/1, retrying 1/5...
Instance of 'NoResponseException'
Placeholder validation failed for batch 1/1, retrying 2/5...
Instance of 'NoResponseException'
Placeholder validation failed for batch 1/1, retrying 3/5...
Instance of 'NoResponseException'
Placeholder validation failed for batch 1/1, retrying 4/5...
Instance of 'NoResponseException'
Placeholder validation failed for batch 1/1, retrying 5/5...
Instance of 'NoResponseException'
Placeholder validation failed for batch 1/1, retrying 6/5...
Failed to get a response from the model
l10n.yaml:
arb-dir: lib/l10n
template-arb-file: intl_en.arb
output-dir: lib/generated/intl/
output-localization-file: l10n.dart
output-class: S
untranslated-messages-file: untranslated-messages-file.txt
# use-deferred-loading: true #enable for web support
synthetic-package: false
nullable-getter: false
arb-translate-context: "Mill (Nine Men's Morris) Game"
Is this the similar issue? Thanks!
Issue
I cannot seem to get
arb_translate
to work anymore. I'm using 0.1.3.It's detecting the missing translations and seems to be calling the API, but cannot parse the response. I couldn't find any additional logs about this.
Config
Command & API key
I first fetched a new API key with
gcloud auth login
andgcloud auth print-access-token
. If I tried to run the command with an old token, it gave an appropriate error message about that.Since 0.1.3?
This happened after installing version 0.1.3, but it also has been a few weeks since I ran it on the previous version.
Other attempts
I've also tried with removing the new
arb-translate-exclude-locales
option but I've got the same result. Also adding "bg" to the excluded languages didn't help. It properly skipped "bg" but had the same issue with "de".I've also tried removing the new labels and just adding one simple label:
but it also failed to parse for this single label.