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

refactor: drop support for internal i18n resolution #244

Merged
merged 4 commits into from
Apr 7, 2023

Conversation

zmstone
Copy link
Member

@zmstone zmstone commented Apr 6, 2023

refactor: drop support for internal i18n resolution

From now on type description (doc) multi-lang resultion
has to be done in a injected desc resolution callback.

Or provide no callback and use the dummy resolver
which generates a reference to the description
so it can be resolved later.

prior to this change, the 'hidden' boolean flag was is used to
hide fields in the schema dumps.
now it is changed to use a enum flag named 'importance'

importance can be 'high', 'medium', 'low' or 'hidden'.

if a filed is at 'hidden' importance level, the default values
will not be filled in hocon_tconf:make_serializable.
@zmstone zmstone force-pushed the 0406-resolve-i18n-externally branch from 1d53e03 to afc9518 Compare April 6, 2023 10:38
From now on type description (doc) multi-lang resultion
has to be done in a injected desc resolution callback.

Or provide no callback and use the dummy resolver
which generates a reference to the description
so it can be resolved later.
@zmstone zmstone force-pushed the 0406-resolve-i18n-externally branch from afc9518 to 0fe53d8 Compare April 6, 2023 10:43
thalesmg
thalesmg previously approved these changes Apr 6, 2023
Copy link
Contributor

@thalesmg thalesmg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, in EMQX's side, the doc generation step will have to provide something like desc_resolved => fun(Desc) -> read(LangFile, Desc) end?

@zmstone
Copy link
Member Author

zmstone commented Apr 6, 2023

So, in EMQX's side, the doc generation step will have to provide something like desc_resolved => fun(Desc) -> read(LangFile, Desc) end?

more like:

{ok, Desc} = hocon:load("path/to/desc/en/file.hocon"),
desc_resolver => fun({desc, Ns, Id}) -> hocon_maps:deep_get(str(Ns) ++ "." ++ str(Id), Desc) end,

@zmstone zmstone merged commit 63b0f62 into emqx:master Apr 7, 2023
3 checks passed
@zmstone zmstone deleted the 0406-resolve-i18n-externally branch April 7, 2023 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants