Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tuist generates TuistStrings+Module from wrong localization strings file #4627

Closed
bozongiggsa opened this issue Jul 20, 2022 · 10 comments · Fixed by #5454
Closed

Tuist generates TuistStrings+Module from wrong localization strings file #4627

bozongiggsa opened this issue Jul 20, 2022 · 10 comments · Fixed by #5454
Assignees
Labels
bounty Resolving this issue is rewarded with a bounty: https://github.com/tuist/tuist/discussions/4982

Comments

@bozongiggsa
Copy link

Describe the bug and the expected behavior

If project contains several languages with different regions, ex. en, en-GB, en-NG and "ru" is set as Development Language through Options in Project, then Tuist gets en-GB.lproj/Localizable.strings as a source for generation of TuistStrings+Module file. But I expect that ru.lproj/Localizable.strings would be used as a source for keys when Tuist are generating TuistStrings+Module

Reproduction steps

Steps to reproduce the bug:

  1. Add Localizable.strings for framework Module and add several languages for it. For instance: en, en-GB, fi, de
  2. Set "de" as a Development Language. The main thing that it should differs from "en", "en-GB"
  3. Make "tuist generate"
  4. Look at TuistStrings+Module.swift file.

Results: keys in TuistStrings+Module.swift are generated from en-GB.lproj/Localizable.strings file
Expected: keys are generated from de.lproj/Localizable.strings.

Error screenshots

image
image
image

Additional context

  • macOS version: 12.4
  • Tuist version: 3.5.0
  • Xcode version: 13.3.1 (13E500a)

Add any other context about the problem here.

@fortmarek
Copy link
Member

Hey @bozongiggsa 👋

You can find the file used for generating these accessors here. That being said, shouldn't the keys be the same regardless of your current development language? That's the point of keys, they stay the same across the languages 🤔

@danieleformichelli
Copy link
Collaborator

Hey @bozongiggsa 👋

You can find the file used for generating these accessors here. That being said, shouldn't the keys be the same regardless of your current development language? That's the point of keys, they stay the same across the languages 🤔

I think they might be different in case you have some strings not localized in all locales, for example for experiments or features available only in some specific languages/regions

@AllDmeat
Copy link

AllDmeat commented Aug 15, 2022

That being said, shouldn't the keys be the same regardless of your current development language?

Yes, but no.
In our app we support over 13 languages, and that for today. In a few month we may have more.
During new features development we're adding keys for development language only, because we simply don't know all other supported languages.
But translators do know. We've integrated translation service — it ships all news keys from development language to translators, they translate, and we receive the result back. That is the time when key with it's translated string is added into the project for the specific language by translation service. Until that time some languages may have not all supported keys. Expect for development language, because it's, well, a development language.

@danieleformichelli danieleformichelli added the bounty Resolving this issue is rewarded with a bounty: https://github.com/tuist/tuist/discussions/4982 label Jan 23, 2023
@github-actions
Copy link
Contributor

Hola 👋,

We want to inform you that the issue has been marked as stale. This means that there hasn't been any activity or updates on it for quite some time, and it's possible that it may no longer be relevant or actionable.
If you still believe that this issue is valid and requires attention, please provide an update or any additional information that can help us address it. Otherwise, we may consider closing it in the near future.
Thank you for your understanding.

@github-actions github-actions bot added the stale label Jul 17, 2023
@danieleformichelli
Copy link
Collaborator

Hi @bozongiggsa @AllDmeat , if you'd like to contribute to the feature, feel free to start from the pointer that Marek lined above, and if you have any question feel free to ask 🙏

@github-actions github-actions bot removed the stale label Jul 19, 2023
@leszko11
Copy link
Collaborator

Hey there 👋
I did some debugging and I think the only thing to have it working is setting defaultKnownRegions in project options
If defaultKnownRegions is not set, SynthesizedResourceInterfaceProjectMapper uses ["Base", "en"] as default, and then returns first resource path - ["Base", "en"] if exist

Is there any reason to have ["Base", "en"] as default? Without default value, SynthesizedResourceInterfaceProjectMapper will respect developmentRegion project option

@leszko11 leszko11 self-assigned this Sep 27, 2023
@fortmarek
Copy link
Member

Hey 👋

Nice find! Can we rewrite the line, so it takes the region for defaultKnownRegions from the developmentRegion instead?

@leszko11
Copy link
Collaborator

Yes,

I think default values in var regionPriorityQueue = defaultKnownRegions ?? ["Base", "en"] are not needed, because developmentRegion is used in the next line.
Without ["Base", "en"] it will use:

  • developmentRegion language if set, and exists in localizables list
  • first language from the languages list

@fortmarek
Copy link
Member

Makes sense, would you be up to implement this change? 😇

@leszko11
Copy link
Collaborator

On it 🫡

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty Resolving this issue is rewarded with a bounty: https://github.com/tuist/tuist/discussions/4982
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants