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

Make whole types translatable #7

Open
gmiserez opened this issue Oct 21, 2022 · 0 comments
Open

Make whole types translatable #7

gmiserez opened this issue Oct 21, 2022 · 0 comments
Labels
enhancement New feature or request Translations This concerns the Translations Package

Comments

@gmiserez
Copy link
Collaborator

Currently, only fields can be made translatable.
If we use the same type, for example RiskClass, for several fields of our Schema, we need to put the Translate directive on every one of these fields:

public class Employee
{
        [Translate<RiskClass>(resourceKeyPrefix: "RiskClasses")]
        public RiskClass RiskClass{ get; }
}

public class ChemicalCompound
{
        [Translate<RiskClass>(resourceKeyPrefix: "RiskClasses")]
        public RiskClass RiskClass{ get; }
}

public class FinancialAsset
{
        [Translate<RiskClass>(resourceKeyPrefix: "RiskClasses")]
        public RiskClass RiskClass{ get; }
}

It would be neat to instead be able to translate and/or rewrite the type RiskClass globally, so that we only need to use the Translate Attribute once:

[Translate<RiskClass>(resourceKeyPrefix: "RiskClasses")]
public enum RiskClass
{
        Low,
        Medium,
        High,
}

This would then rewrite every field of type RiskClass to a TranslatedResourceOfRiskClass.
Support for the translatable and translated patterns would also be appreciated.

@gmiserez gmiserez added enhancement New feature or request Translations This concerns the Translations Package labels Oct 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Translations This concerns the Translations Package
Projects
None yet
Development

No branches or pull requests

1 participant