philfung/add-to-homescreen

Please consider to add multi language support with language files

devmilitia opened this issue · 6 comments

Please consider to add multi language support with language files, for the modal and modal texts.
Best Regards.

Which languages are you specifically looking for?

I look for spanish language partner

I edit the assets to spanish language, and the JS file.
share with US in: https://drive.google.com/drive/folders/1jWfTnk0WIWt_KE0McGjNp2iojZ-0Rp5D?usp=sharing

as a workaround, you can extend it and translate indiviual methods:

class AddToGermanHomeScreen extends window.AddToHomeScreen {
  _genTitle() {
    return this._genTitleWithMessage(
      `Installieren Sie die ${this.appName} App, um fortzufahren`,
    );
  }
  _safariAddToHomeScreenButtonDe() {
    return (
      'data:image/svg+xml;base64,' +
      btoa(`<svg xmlns="http://www.w3.org/2000/svg" width="161" height="30" fill="none">
              <path fill="#F5F5F5" d="M0 0h161v30H0z"/>
              <path fill="#000" d="M151.984 19.251a3.767 3.767 0 0 1-1.104 2.654A3.733 3.733 0 0 1 148.226 23l-9.482-.017a3.747 3.747 0 0 1-2.65-1.104A3.757 3.757 0 0 1 135 19.222l.016-9.473a3.767 3.767 0 0 1 1.104-2.654A3.733 3.733 0 0 1 138.774 6l9.482.017c.995.001 1.948.399 2.65 1.104A3.757 3.757 0 0 1 152 9.778l-.016 9.473Zm-1.225-9.3a2.686 2.686 0 0 0-.78-1.894 2.675 2.675 0 0 0-1.888-.787l-9.167-.016a2.667 2.667 0 0 0-2.472 1.648 2.685 2.685 0 0 0-.206 1.023l-.015 9.059a2.666 2.666 0 0 0 .779 1.894 2.676 2.676 0 0 0 1.889.787l9.166.016a2.676 2.676 0 0 0 2.473-1.648c.134-.324.204-.672.205-1.024l.016-9.058Z"/>
              <path fill="#000" d="M147.189 14.019h-7.056a.641.641 0 1 0 0 1.283h7.056a.642.642 0 0 0 0-1.283Z"/>
              <path fill="#000" d="M144.302 18.189v-7.057a.641.641 0 1 0-1.283 0v7.057a.641.641 0 1 0 1.283 0Z"/>
              <text xml:space="preserve" fill="#000" font-family="-apple-system, BlinkMacSystemFont, sans-serif" font-size="12" font-weight="500" letter-spacing="0em" style="white-space:pre"><tspan x="6.313" y="18.048">Zum Home-Bildschirm
            </tspan></text>
            </svg>
          `)
    );
  }
  _genIOSSafari(container) {
    var containerInnerHTML =
      this._genLogo() +
      this._genModalStart() +
      this._genTitle() +
      this._genListStart() +
      this._genListItem(
        '1',
        `Tippen Sie auf die 
          <img
            class="adhs-ios-safari-sharing-api-button"
            src="${this._genAssetUrl('ios-safari-sharing-api-button.svg')}"/>
          Schalt­fläche unten.`,
      ) +
      this._genListItem(
        '2',
        `Wählen Sie 
        <img
          class="adhs-ios-safari-add-to-home-screen-button"
          src="${this._safariAddToHomeScreenButtonDe()}"
        />
        aus dem Menü, das sich öffnet.
        <span class="adhs-emphasis">
          Möglicher­weise müssen Sie nach unten scrollen, um diesen Menüpunkt zu finden.
        </span>`,
      ) +
      this._genListItem(
        '3',
        `Öffnen Sie die <img class="adhs-your-app-icon" src="${this.appIconUrl}"/> app.`,
      ) +
      this._genListEnd() +
      this._genModalEnd() +
      `<div class="adhs-ios-safari-bouncing-arrow-container">
      <img src="${this._genAssetUrl('ios-safari-bouncing-arrow.svg')}" alt="arrow" />
    </div>`;
    container.innerHTML = containerInnerHTML;
    container.classList.add('adhs-ios');
    container.classList.add('adhs-safari');
  }
}