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

✨ Add Alexa generic locale merging in manifest #1607

Conversation

sadlowskij
Copy link
Contributor

Proposed Changes

This change merges privacyAndCompliance and publishingInformation of the genericLocale into the locale.

Using this ProjectConfig:

const project = new ProjectConfig({
  endpoint: '${JOVO_WEBHOOK_URL}',
  plugins: [
    new AlexaCli({
      locales: {
        en: ['en-US', 'en-GB', 'en-IN'],
      },
      files: {
        'skill-package/skill.json': {
          manifest: {
            publishingInformation: {
              locales: {
                en: {
                  updatesDescription: 'cool new features',
                  summary: 'summary',
                },
                'en-US': {
                  summary: 'en-US summary',
                  description: 'en-US description'
                }
              }
            },
          },
        },
      }
    })
  ],
});

The generated en-US locale in publishingInformation.locales looks like this (no update description):

{
  "summary": "en-US summary",
  "description": "en-US description"
}

After the changes of this branch it will merge in the generic locale, to look like this

{
  "updatesDescription": "cool new features",
  "summary": "en-US summary",
  "description": "en-US description"
}

As can be seen, this change merges the generic locale with the specific locale, where the specific locale properties override the generic ones. If neither generic nor specific locales are set, the default publishingInfos and pricavyAndCompliance will be set.

As the checkLocales function increased further in size, I refactored this function for easier readability.

I tested this with multiple cases I could think of, and could not find any issues, if you find a weak spot, please let me know!

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My code follows the code style of this project
  • My change requires a change to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

@aswetlow
Copy link
Member

Again, thank you so much!

Copy link
Member

@jankoenig jankoenig left a comment

Choose a reason for hiding this comment

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

Looks great! Thanks a lot @sadlowskij 🎉

@jankoenig jankoenig merged commit 6dc6bb7 into jovotech:v4/dev Jan 18, 2024
6 checks passed
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.

3 participants