webflorist / privacy-policy-text
Open source texts for a privacy policy in german and english. Available as php or json.
Installs: 1 900
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires (Dev)
- php: ^7.4|^8.0
- ext-json: *
README
This package includes open source texts for a GDPR conform privacy policy of a website. They come in php and json files to be used by common translation frameworks.
Table Of Contents
Demo
An demo application with the texts included in this package is avaliable at:
https://privacy-policy-vue-demo.netlify.app/
This demo uses the package webflorist/privacy-policy-vue
.
Features
-
Languages
Currently the package includes texts in german and english language. -
Singular/Plural
The files are provided both from singular and plural viewpoints.
(e.g.My website...
vsOur website...
) -
Formats
Currently the package includes files inphp
as well asjson
format. -
Included Texts
- A general intro text
- Listing of GDPR rights
- Text to introduce data controller
- General data security text (SSL, etc.)
- Cookies information
- Information on data processing of third party data processors:
- Webhosting
- Web analytics
- Interactive maps
- Sending of emails (e.g. contact forms)
- Disclaimer regarding outgoing links
Ecosystem
This package is mainly meant as a backend package for other implementations, which use it to provide a privacy policy component to a certain framework.
The following companion packages are currently available:
Installation
Using composer:
composer require webflorist/privacy-policy-text
Using npm:
npm install --save @webflorist/privacy-policy-text
Using yarn:
yarn add @webflorist/privacy-policy-text
Usage
In Javascript
The ESM module exports the following stuff:
- Objects structured as
{ de: Object, en: Object}
including the translation strings with the corresponding interpolation format:
export const colonPrefixSingular : object export const colonPrefixPlural : object export const curlyWrapSingular : object export const curlyWrapPlural : object export const doubleCurlyWrapSingular : object export const doubleCurlyWrapPlural : object
- An object with information about various processors (see
processors.json
):
export const defaultProcessors : object
- A helper function to render the markdown functionality in the language strings:
export function renderText(text: string): string
Check out the Vue component of webflorist/privacy-policy-vue for an example implementation.
Here is and example using a singular viewpoint and a translation library with curly-wrap interpolations:
import { curlyWrapSingular, renderText } from '@webflorist/privacy-policy-text' import { translate, provideTranslations } from 'my-favourite-translation-library provideTranslations({ de: curlyWrapSingular.de, en: curlyWrapSingular.en, }) const interpolations = { 'webhosting_processor': 'Netlify Inc.', 'analytics_service': 'Google Analytics', 'analytics_processor': 'Google Ireland Limited', 'maps_service': 'Google Maps', 'maps_processor': 'Google LLC', 'send_emails_service': 'Twilio Sendgrid', 'send_emails_processor': 'Twilio Inc.', } // Custom translation function, which uses renderText // from @webflorist/privacy-policy-text after translation. const t = (key) => { return renderText(translate(key, interpolations)) } return ` <p>${t('intro_content.p1')}</p> <p>${t('intro_content.p2')}</p> <section> <h2>${t('gdpr_rights.title')}</h2> <p>${t('gdpr_rights.content.p1')}</p> ... `
Interpolations
(Replacing Parameters In Translation Strings)
Any dynamic parts of the language files can be interpolated by the translation-library of your choice. The following formats are supported (each with corresponding json and php files):
- with colon prefix (
:key
)
(e.g. used by Laravel) - wrapped with curly braces (
{key}
)
(e.g. used by Vue I18n) - wrapped with double curly braces (
{{key}}
)
(e.g. used by i18next)
The following interpolations are present in the language files:
{ // Name of the webhosting service 'webhosting_service': 'Netlify Platform', // Company name of the webhosting processor 'webhosting_processor': 'Netlify Inc.', // Name of the analytics service 'analytics_service': 'Google Analytics', // Company name of the analytics processor 'analytics_processor': 'Google Ireland Limited', // Name of the maps service 'maps_service': 'Google Maps', // Company name of the maps processor 'maps_processor': 'Google LLC', // Name of the email sending service 'send_emails_service': 'Twilio Sendgrid', // Company name of the email sending processor 'send_emails_processor': 'Twilio Inc.', }
Markdown Functionality
The language files include some markdown functionality:
**Bold Elements**
- and
[Links to](#anchors)
The package includes a renderText(text)
function to render these markdowns. The package exports this function. So usage would be as follows:
In Javascript:
import { renderText } from '@webflorist/privacy-policy-text' renderText(myTranslatedString)
Disclaimer
The included text should be suitable for a GDPR-compliant website.
I however do not take any responsibility whatsowever for that.
License
This package is open-sourced software licensed under the MIT license.