Skip to content

Commit

Permalink
Merge pull request #10 from giacomo/ptbr
Browse files Browse the repository at this point in the history
Feature: Portuguese language
  • Loading branch information
giacomo authored Nov 11, 2022
2 parents a619872 + 6b81aa3 commit c3fc74b
Show file tree
Hide file tree
Showing 22 changed files with 348 additions and 175 deletions.
83 changes: 48 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Angular multi-language module to display a cookie consent banner without other d
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https:///pr.new/github.com/giacomo/ngx-cookie-consent)

###### Works with Angular v14+
###### Available languages: English, German, Italian
###### Available languages: English, German, Italian, Portuguese

## Installation

Expand Down Expand Up @@ -55,46 +55,59 @@ import { NgxCookieConsentModule } from '@localia/ngx-cookie-consent';

## Configuration

| Name | Type | Default | Description |
|-----------------------|----------|-------------------|------------------------------------------------------------------------------------|
| privacyPolicyUrl | string | '#' | URL to your privacy policy ⚠ required ⚠ |
| imprintUrl | string | '#' | URL to your imprint ⚠ required ⚠ |
| defaultLanguage | string | 'en' | Default language for the cookie consent banner |
| availableLanguages | string[] | ['en', 'de', 'it'] | Available languages for the cookie consent banner |
| showLanguageSwitcher | boolean | true | Show language switcher |
| showBadgeOpener | boolean | true | Show badge opener |
| openerPosition | enum | 'left-bottom' | Position of the badge eg. 'left-top', 'right-top' , 'left-bottom' , 'right-bottom' |
| customClass | string | '' | Custom class for the cookie consent banner |
| cookiePrefix | string | 'cookieconsent_' | Prefix for the cookie consent banner |
| cookieExpiryDays | number | 365 | Expiry days for the cookie consent banner |
| showCookieDetails | boolean | false | Show cookie details |
| showFunctionalCookies | boolean | true | Show functional cookies |
| functionalCookies | CookieItem[] | [] | Functional cookies |
| showMarketingCookies | boolean | true | Show marketing cookies |
| marketingCookies | CookieItem[] | [] | Marketing cookies |
| showEssentialCookies | boolean | true | Show essential cookies |
| essentialCookies | CookieItem[] | [] | Essential cookies |
| showOtherTools | boolean | true | Show other tools |
| otherTools | CookieItem[] | [] | Other tools |
| excludeRoutes | string[] | [] | Exclude routes eg. ['/privacy-policy'] |
| Name | Type | Default | Description |
|-----------------------|----------------------------------|--------------------|------------------------------------------------------------------------------------|
| privacyPolicyUrl | string | TranslatableString | '#' | URL to your privacy policy ⚠ required ⚠ |
| imprintUrl | string | TranslatableString | '#' | URL to your imprint ⚠ required ⚠ |
| defaultLanguage | string | 'en' | Default language for the cookie consent banner |
| availableLanguages | string[] | ['en', 'de', 'it'] | Available languages for the cookie consent banner |
| showLanguageSwitcher | boolean | true | Show language switcher |
| showBadgeOpener | boolean | true | Show badge opener |
| openerPosition | enum | 'left-bottom' | Position of the badge eg. 'left-top', 'right-top' , 'left-bottom' , 'right-bottom' |
| customClass | string | '' | Custom class for the cookie consent banner |
| cookiePrefix | string | 'cookieconsent_' | Prefix for the cookie consent banner |
| cookieExpiryDays | number | 365 | Expiry days for the cookie consent banner |
| showCookieDetails | boolean | false | Show cookie details |
| showFunctionalCookies | boolean | true | Show functional cookies |
| functionalCookies | CookieItem[] | [] | Functional cookies |
| showMarketingCookies | boolean | true | Show marketing cookies |
| marketingCookies | CookieItem[] | [] | Marketing cookies |
| showEssentialCookies | boolean | true | Show essential cookies |
| essentialCookies | CookieItem[] | [] | Essential cookies |
| showOtherTools | boolean | true | Show other tools |
| otherTools | CookieItem[] | [] | Other tools |
| excludeRoutes | string[] | [] | Exclude routes eg. ['/privacy-policy'] |

### CookieItem interface

| Name | Type | Description |
|-------------|--------|-------------------------------------------------------------------------------------------------------------------------------------|
|key | string | Key for the cookie eg. 'functional_google_analytics' |
|name | string | Name for the cookie eg. 'Google Analytics' |
|description | string | Description for the cookie eg. 'Google Analytics is a web analytics service offered by Google that tracks and reports website traffic.' |
|privacyPolicyUrl| string | URL to the privacy policy for the cookie eg. 'https://policies.google.com/privacy' |
|cookies | CookieDetail[] | Cookie details for the cookie |
| Name | Type | Description |
|------------------|----------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------|
| key | string | Key for the cookie eg. 'functional_google_analytics' |
| name | string | TranslatableString | Name for the cookie eg. 'Google Analytics' |
| description | string | TranslatableString | Description for the cookie eg. 'Google Analytics is a web analytics service offered by Google that tracks and reports website traffic.' |
| privacyPolicyUrl | string | TranslatableString | URL to the privacy policy for the cookie eg. 'https://policies.google.com/privacy' |
| cookies | CookieDetail[] | Cookie details for the cookie |

### CookieDetail interface

| Name | Type | Description |
|-------------|--------|-----------------------------------------------------------------------------|
|name | string | Name for the saved cookie eg. '_ga' |
|description | string | Description for the saved cookie eg. 'This cookie is used to distinguish users.' |
|duration | string | Duration for the saved cookie eg. '2 years' |
| Name | Type | Description |
|-------------|----------------------------------|----------------------------------------------------------------------------------|
| name | string | Name for the saved cookie eg. '_ga' |
| description | string | TranslatableString | Description for the saved cookie eg. 'This cookie is used to distinguish users.' |
| duration | string | TranslatableString | Duration for the saved cookie eg. '2 years' |

### TranslatableString interface

The `TranslatableString` interface is used to define a string that can be translated into multiple languages. **It is optional to use this interface. If you don't use it, the string will be used as it is.**

> ⚠ The `TranslatableString` interface if used, will automatically fall back to defaultLanguage used if no translation key defined for the desired language.
| Name | Type | Description |
|------|--------|-----------------------------------------|
| en | string | English string for the specified key |
| de | string | German string for the specified key |
| it | string | Italian string for the specified key |
| pt | string | Portuguese string for the specified key |

## Contributing

Expand Down
Loading

0 comments on commit c3fc74b

Please sign in to comment.