Xcode 10 - How to refresh localization of a Siri shortcut intent definition file?
Asked Answered
S

3

7

I have an intent definition file for a Siri shortcut. When I click on localize Xcode does very well create a localization file, each string beeing used is present with an ID. But how do I refresh this if I added a new intent in the same file or just added a new possible response to the same file? I currently only found two ways:

  • Delete localization and set up new again (which makes you loose all translated strings in all languages besides default).
  • Export all translations for the whole app and reimport (which leads to problems if your complete app is not yet ready for new localization export/import).

So, does anybody know a way to refresh the auto-localization of an intents definition file?

Silici answered 5/10, 2018 at 5:45 Comment(4)
Had a conversation with Apple devs about that. It is actually intended how it is now... But they agreed, the experience is not the best and it might be considered in future.Silici
For smaller changes one can use git diff to get the newly added IDs.Duumvir
Anyone checked if it changed in Xcode 12? Localizing Intents seems to have been a big pain in the butt...Zaratite
Nope, there is still a need to regenerate localizations if you add or remove an intent in 2020 (almost 2021).Zaratite
K
2

I ran into the same problem lately, and I managed to fix it with a simple workaround and two small, quick and dirty scripts:

  1. Be sure to have your old localizations .strings files in your git repository
  2. Uncheck all your .intendefinition localizations (and delete them)
  3. Check back all your localizations, it will recreate the .strings files, but without your old translations (hopefully, they are safe in git)
  4. DO NOT COMMIT THEM (yet)
  5. For each .strings file run my little script this way: {script-path}/update-modified-strings-file.sh {project-path}/xx.lproj/YourIntents.strings
  6. Check if everything is ok
  7. Commit
  8. Live long and prosper...

Please be sure to put both scripts in the same directory:

The first script checks out the old version of the strings with your existing translations, the second merges the new file containing new entries with the old existing translations.

Hope this helps.

Krebs answered 8/1, 2020 at 14:55 Comment(0)
S
1

I wish Apple would fix with this.

In the meantime, the easiest way of dealing with it that I've found is this...

Add support for a new language in your project. For example, add Australian English. Then you'll get a new .strings file with all the new keys in it with the values from your intents definition.

Paste the contents of that into your existing English version and delete support for that new language.

If you want to get the new keys merged into your existing localised .strings files then you can use this https://github.com/Flinesoft/BartyCrouch Once it's installed you can run bartycrouch update and it'll sync the changes into all your .strings files.

Streit answered 16/4, 2022 at 21:3 Comment(1)
There's now a successor to BartyCrouch, you might want to check it out, it has a nice GUI and several other improvements over BartyCrouch: remafox.appHartal
C
0

I have the same question, i played around with this exact thing tonight. From what i can see, i have to remove all localized files and recreate them, just like you said...

Courtroom answered 24/1, 2019 at 21:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.