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

Please consider to add multi language support with language files #7

Open
devmilitia opened this issue Jan 28, 2024 · 5 comments
Open

Comments

@devmilitia
Copy link

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

@philfung
Copy link
Owner

Which languages are you specifically looking for?

@devmilitia
Copy link
Author

I look for spanish language partner

@devmilitia
Copy link
Author

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

@loominade
Copy link

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');
  }
}

@jpjust
Copy link
Contributor

jpjust commented May 17, 2024

The project now supports multi-language through i18n. Just take a look at src/locales folder and you will find some translation files. Just make a copy of one of them and translate the strings to Spanish and then add your new locale in src/index.js.

Create a pull request so the maintainer will push it into the original code.

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

No branches or pull requests

4 participants