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(i18n): translation key autocomplete #231

Merged
merged 32 commits into from
Mar 14, 2023

Conversation

adamdehaven
Copy link
Member

@adamdehaven adamdehaven commented Mar 9, 2023

Summary

Provide type-safety and auto-completion for translation keys when utilizing the t(), te(), and tm() functions.

Todo:

image

Translation Component types

I can't get auto-completion to work with the keypath prop of the i18n-t (Translation.ts) component as I get an error when setting the String as PropType<PathToDotNotation<MessageSource, string>>:

The inferred type of X references a type with a cyclic structure which cannot be trivially serialized.

It appears to be an issue related to the recursion necessary to parse the JSON object.

PR Checklist

  • Naming & Structure: the files and package structure use the conventions outlined in the Creating a Package docs.
  • Tests pass: check the output of all package unit and/or component tests.
    • If this PR is the result of a bug, test coverage was added accordingly.
  • Functional: all changes do not break existing APIs, but if so, a BREAKING CHANGE commit is in place to bump the major version.
  • Conventional Commits all commits follow the conventional commit standards outlined in the main README.
  • Docs: includes a technically accurate README, and the docs have been updated accordingly based on the changes in this PR.

@adamdehaven adamdehaven self-assigned this Mar 9, 2023
@adamdehaven adamdehaven requested a review from a team as a code owner March 9, 2023 20:26
ValeryG
ValeryG previously approved these changes Mar 9, 2023
@adamdehaven adamdehaven marked this pull request as draft March 9, 2023 22:17
adamdehaven and others added 13 commits March 12, 2023 15:57
 - @kong-ui-public/spec-renderer@0.7.10
 - @kong-ui-public/spec-renderer@0.7.11
 - @kong-ui-public/swagger-ui-web-component@0.4.13
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
 - @kong-ui-public/metric-cards@0.1.15
 - @kong-ui-public/app-layout@0.13.25
 - @kong-ui-public/copy-uuid@0.2.22
 - @kong-ui-public/misc-widgets@0.2.24
 - @kong-ui-public/document-viewer@0.5.24
 - @kong-ui-public/spec-renderer@0.7.12
 - @kong-ui-public/swagger-ui-web-component@0.4.14
 - @kong-ui-public/spec-renderer@0.7.13
 - @kong-ui-public/swagger-ui-web-component@0.4.15
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
 - @kong-ui-public/metric-cards@0.1.16
 - @kong-ui-public/app-layout@0.13.26
 - @kong-ui-public/copy-uuid@0.2.23
 - @kong-ui-public/misc-widgets@0.2.25
 - @kong-ui-public/document-viewer@0.5.25
 - @kong-ui-public/spec-renderer@0.7.14
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
kongponents-bot and others added 11 commits March 12, 2023 16:24
 - @kong-ui-public/metric-cards@0.1.17
 - @kong-ui-public/app-layout@0.13.27
 - @kong-ui-public/copy-uuid@0.2.24
 - @kong-ui-public/misc-widgets@0.2.26
 - @kong-ui-public/document-viewer@0.5.26
 - @kong-ui-public/spec-renderer@0.7.15
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
 - @kong-ui-public/metric-cards@0.1.18
 - @kong-ui-public/app-layout@0.13.28
 - @kong-ui-public/copy-uuid@0.2.25
 - @kong-ui-public/misc-widgets@0.2.27
 - @kong-ui-public/document-viewer@0.5.27
 - @kong-ui-public/spec-renderer@0.7.16
@adamdehaven adamdehaven marked this pull request as ready for review March 14, 2023 15:03
@adamdehaven adamdehaven merged commit bdc237d into main Mar 14, 2023
@adamdehaven adamdehaven deleted the feat/i18n-translation-key-autocomplete branch March 14, 2023 15:27
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.

6 participants