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

[Feat] Support for LocalizedStringResource #93

Open
ConfusedVorlon opened this issue Apr 3, 2023 · 1 comment
Open

[Feat] Support for LocalizedStringResource #93

ConfusedVorlon opened this issue Apr 3, 2023 · 1 comment
Assignees
Labels
Feature Request New functionality the app doesn't provide yet Size: Small Probably less than 1 week of work

Comments

@ConfusedVorlon
Copy link

Problem Statement

AppIntents require LocalizedStringResource
These are essentially lazily loaded localized strings
The ergonomics are painful though.

static var title: LocalizedStringResource = LocalizedStringResource("Intent.AskMeAnything")
but to use code, I need to use

static var title: LocalizedStringResource = LocalizedStringResource(String.LocalizationValue(stringLiteral: Loc.Intent.AskChatter.tableLookupKey))

Suggested Solution

provide a generated localizedStringResource variable on the enum (or similar)

Additional Considerations

I mentioned before that the generated file could be WAY smaller if it just used a protocol with automated conformance.
(at least for simple singular strings)
Even more so if there is another property in play.

@Jeehut
Copy link
Member

Jeehut commented Apr 4, 2023

@ConfusedVorlon Thank you for requesting this feature.

When I worked on the generated file, the LocalizedStringResource type wasn't released yet, therefore I didn't figure out if and how it could be included. But it makes sense to support them in the generated file. I will also consider moving to a protocol-based file. As I wrote before, the one thing I need to verify is that auto-completion works just as reliably as with the non-protocol style that I ship currently. If it doesn't, I think I will at least default to the current expanded style but might still provide an option to opt for the protocol instead. Mostly because it's generated code anyways, so it shouldn't really matter how long the file is, developers shouldn't really care about its contents. But as I can see, some still do, so I'll consider it for sure. 😉

@Jeehut Jeehut self-assigned this Apr 4, 2023
@Jeehut Jeehut added Feature Request New functionality the app doesn't provide yet Size: Small Probably less than 1 week of work labels Apr 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature Request New functionality the app doesn't provide yet Size: Small Probably less than 1 week of work
Projects
None yet
Development

No branches or pull requests

2 participants