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

✨ support for generic locale alexa manifest definition #1542

Merged

Conversation

sadlowskij
Copy link
Contributor

Proposed Changes

I think it would be handy to support the generic locales defined in the AlexaCliConfig (AlexaCliConfig.locales) to be applied to the specific locales for the localized sections of the manifest publishingInformations and privacyAndCompliance.

My Commit would make it possible, to either define one of those properties for a specific locale (e. g. just for en-AU) while also being able to define one en generic locale, that gets applied to all other en locales that don't have a specific entry.

So with a config like this:

    new AlexaCli({
      locales: {
        en: ['en-AU', 'en-US', 'en-IN'],
        de: ['de-DE']
      },
      files: {
        'skill-package/skill.json': {
          manifest: {
            publishingInformation: {
              locales: {
                en: {
                  info: "All en have this"
                },
                de: {
                  info: "All de have this"
                }
              }
            },
            privacyAndCompliance: {
              locales: {
                'de': {
                  privacyPolicyUrl: 'https://test.com/de/datenschutz/',
                  termsOfUseUrl: 'https://test.com/de/agb/',
                },
                // Will be applied to en-US and en-IN
                'en': {
                  privacyPolicyUrl: 'https://test.com/en/privacy/',
                  termsOfUseUrl: 'https://test.com/en/tos/',
                },
                'en-AU': {
                  privacyPolicyUrl: 'https://test-au.com/en/privacy-australia/',
                  termsOfUseUrl: 'https://test-au.com/en/tos-australia/',
                },
              },
              allowsPurchases: false,
              containsAds: false,
              isChildDirected: false,
              isExportCompliant: true,
              usesPersonalInfo: false,
            },
          },
        },
      }
    })

So it will lead to:

{
  "manifest": {
    "publishingInformation": {
      "locales": {
        "de-DE": {
          "info": "All de have this"
        },
        "en-AU": {
          "info": "All en have this"
        },
        "en-US": {
          "info": "All en have this"
        },
        "en-IN": {
          "info": "All en have this"
        }
      }
    },
    "privacyAndCompliance": {
      "locales": {
        "en-AU": {
          "privacyPolicyUrl": "https://test-au.com/en/privacy-australia/",
          "termsOfUseUrl": "https://test-au.com/en/tos-australia/"
        },
        "de-DE": {
          "privacyPolicyUrl": "https://test.com/de/datenschutz/",
          "termsOfUseUrl": "https://test.com/de/agb/"
        },
        "en-US": {
          "privacyPolicyUrl": "https://test.com/en/privacy/",
          "termsOfUseUrl": "https://test.com/en/tos/"
        },
        "en-IN": {
          "privacyPolicyUrl": "https://test.com/en/privacy/",
          "termsOfUseUrl": "https://test.com/en/tos/"
        }
      },
      "allowsPurchases": false,
      "containsAds": false,
      "isChildDirected": false,
      "isExportCompliant": true,
      "usesPersonalInfo": false
    },
    "apis": {
      "custom": {
        "endpoint": {
          "sslCertificateType": "Wildcard",
          "uri": "[URL]"
        }
      }
    }
  }
}

It also makes sure to remove the generic locales from the properties, as this would break in the deployment

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

Very useful! Thank you

@aswetlow aswetlow requested a review from jankoenig April 24, 2023 11:21
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.

Thanks a lot @sadlowskij 🎉 this is a cool feature

@jankoenig jankoenig merged commit cf81ac4 into jovotech:v4/dev May 4, 2023
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