RemafoX icon indicating copy to clipboard operation
RemafoX copied to clipboard

[Feat] Localised Intent files are only supported when using Base-localization

Open Sherlouk opened this issue 3 years ago • 3 comments
trafficstars

Steps to Reproduce:

  1. Create a new .intentdefinition file
  2. Enable localisation on it
  3. Try and add a new localisation to it using ReMafoX

Expected Behavior:

It should detect the base language and any additional languages, enabling you to add a new translation.

Current Behavior:

ReMafoX throws an error (ATWxL) stating that "No Strings(dict) file with the source language English was found."

This is because localisation for intent files is handled differently, with the base or source language (English here) is not defined in a strings file but rather is the intent file itself. Additional languages do have their own strings file, such as:

"4TnG5L" = "..";
"RSc3Ye" = "..";

image

You can also see this is in the above screenshot. Welsh is a string files, but English is an intent file.

Environment

Show environment details
  • App Version: 1.0.2 (Build 51)
  • System Version: 13.0 (Build 22A5342f)
  • System CPU: Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz

Sherlouk avatar Oct 15 '22 11:10 Sherlouk

@Sherlouk Thank you for reporting this.

I just verified how things work with Intents and to me it looks like Intent files behave exactly like Storyboard or XIB files in regard to translation: You can either skip Base-localization entirely (like you did) and simply use the Intent definition file as one localization. Or you can use Base-localization for your Intent definition file and provide a Strings file for every other language. See here: Base-localized Intent

Because it's additional work and also bug-prone to support each type of file that could be also Base-localized, I decided to require users to use Base-localization in order to be able to use ReMafoX, at least for now. The alternative would be that each time you run any ReMafoX commands like normalize, the app would need to extract the Strings from the Intent definition file and create a temporary Strings file for your source language to do things like "harmonize keys".

In other words: Localized Intent files actually are supported, but only if you use Base-localization. So all you need to do as of now to get this working is to move your Intent definition file from the en.lproj folder to the Base.lproj folder (create it if it doesn't exist) and create a .strings file inside the en.lproj folder instead and add your English translations there. Then, all should work as expected.

Having that said, I'm totally open to add native support for Intent definition files directly so no need for Base-localization is needed, but because there's an workaround, I'm converting this from a bug report to a feature request. Please upvote it if you want me to add support for non-Base-localized Intent files so I can prioritize it accordingly.

Jeehut avatar Oct 15 '22 13:10 Jeehut

I can confirm that using Base localisation has resolved the issue with intent files. I'd welcome support for ReMafoX to support projects without Base localisation but given the available workaround I appreciate this is low priority.

What I might suggest though as more of a higher priority would be to improve the error reporting for this kind of scenario? It's not obvious within ReMafoX that you should use Base localisation and for a better onboarding experience I think a prompt could be valuable.

Sherlouk avatar Oct 15 '22 13:10 Sherlouk

@Sherlouk That's a very good point. I just created https://github.com/FlineDev/ReMafoX/issues/41 to improve on the UX here.

Jeehut avatar Oct 15 '22 15:10 Jeehut