webflorist/隐私政策文本

德语和英语隐私政策的开源文本。提供php或json格式。

v1.5.4 2022-01-14 23:07 UTC

README

Latest Stable Composer Version Latest Stable npm Version License

此软件包包含网站GDPR合规隐私政策的开源文本。它们以php和json文件的形式提供,以便在常见的翻译框架中使用。

目录

演示

包含此软件包中文本的演示应用程序可在以下网址找到:
https://privacy-policy-vue-demo.netlify.app/

此演示使用软件包 webflorist/privacy-policy-vue

功能

  • 语言
    目前,该软件包包括德语和英语语言文本。

  • 单数/复数
    文件既提供单数视角也提供复数视角。
    (例如 我的网站...我们的网站...)

  • 格式
    目前,该软件包包括php和json格式的文件。

  • 包含的文本

    • 一般 简介文本
    • GDPR权利列表
    • 介绍 数据控制器 的文本
    • 一般 数据安全 文本(SSL等)
    • Cookie 信息
    • 第三方数据处理者处理数据的 数据加工 信息
      • 网站托管
      • 网站分析
      • 交互式地图
      • 发送电子邮件(例如,联系表单)
    • 关于 外部链接 的免责声明

生态系统

此软件包主要用作其他实现的后端软件包,其他实现可以使用它为特定框架提供隐私政策组件。

以下是一些目前可用的配套软件包

安装

使用composer

composer require webflorist/privacy-policy-text

使用npm

npm install --save @webflorist/privacy-policy-text

使用yarn

yarn add @webflorist/privacy-policy-text

使用方法

在JavaScript中

ESM模块导出以下内容

  • 结构为 { de: Object, en: Object} 的对象,包括带有相应 插值 格式的翻译字符串
export const colonPrefixSingular : object
export const colonPrefixPlural : object
export const curlyWrapSingular : object
export const curlyWrapPlural : object
export const doubleCurlyWrapSingular : object
export const doubleCurlyWrapPlural : object
export const defaultProcessors : object
  • 一个辅助函数,用于在语言字符串中渲染 Markdown功能
export function renderText(text: string): string

查看 webflorist/privacy-policy-vue的Vue组件 以获取示例实现。

以下是一个使用单数视角和带有花括号插值的翻译库的示例

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>

    ...
`

插值

(在翻译字符串中替换参数)

任何动态部分的语言文件都可以由您选择的翻译库进行插值。以下格式得到支持(每个格式都对应json和php文件)

  • 使用冒号前缀(:key
    (例如,由 Laravel 使用)
  • 用花括号括起来({key}
    (例如,由 Vue I18n 使用)
  • 用双花括号括起来({{key}}
    (例如,由 i18next 使用)

语言文件中存在以下插值

{
    // 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功能

语言文件包含一些Markdown功能

  • **粗体元素**
  • 以及 [链接到](#anchors)

此包包含一个 renderText(text) 函数来渲染这些Markdown。该包导出此函数。因此使用方式如下

在JavaScript中

import { renderText } from '@webflorist/privacy-policy-text'

renderText(myTranslatedString)

免责声明

包含的文本 适用于符合GDPR的网站。

但我对此不承担任何责任。

许可证

此包是开源软件,受MIT许可证许可。