npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@candidosales/svelte-google-translate

v0.0.15

Published

Google Translate component for Svelte

Downloads

114

Readme

Svelte Google Translate

Installation

npm i @candidosales/svelte-google-translate

screenshot

Usage

<script>
	import { GoogleTranslate } from '@candidosales/svelte-google-translate';
</script>

<h1>Svelte Google Translate</h1>
<GoogleTranslate
	elementId={'google-translate-element'}
	options={{ pageLanguage: 'pt', includedLanguages: 'pt,en' }}
/>
<div id="google-translate-element">
	<p>Test</p>
</div>

| Attributes | Default value | Description | | ---------- | :--------------------------: | ------------------------------------------------------------------------------------------- | | elementId | 'google-translate-element' | This option specifies the HTML element ID. The default value is google-translate-element. | | options | | This option specifies all config that TranslateElementOptions provides. |

Options

| Option | Default value | Description | | ----------------- | :-------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | pageLanguage | 'pt' | This option specifies the language of the page that you want to translate. The default value is "auto", which means that Google will detect the language automatically. | | includedLanguages | 'pt,en,es,fr,nl,ja,zh-CN' | This option is an array of language codes that you want to include in the language selector. If you don't specify this option, Google will include all languages that are supported by the API. Supported languages: https://cloud.google.com/translate/docs/languages. | | layout | true | This option specifies the layout of the language selector. The default value is "horizontal", which displays the language names in a row. Other options include "vertical" (displays the language names in a column) and "dropdown" (displays the language names in a dropdown menu). | | autoDisplay | true | This option specifies whether or not to display the language selector automatically. The default value is true. | | multilanguagePage | false | This option specifies whether or not the page being translated contains multiple languages. The default value is false. | | gaTrack | false | This option specifies whether or not to track translation events using Google Analytics. The default value is false. | | gaId | `` | This option specifies the Google Analytics tracking ID to use if gaTrack is set to true. | | layoutCompact | false | This option specifies whether to use a compact layout for the language selector. The default value is false. | | floatPosition | TOP_LEFT | This option specifies the position of the language selector if layoutCompact is set to true. The default value is "TOP_LEFT", other options include "TOP_RIGHT", "BOTTOM_LEFT", and "BOTTOM_RIGHT". | | timeout | 5000 | This option specifies the time in milliseconds before the API returns an error if it fails to load. The default value is 5000. | | newVersion | false | This option specifies whether to use the new version of the Google Translate API. The default value is false. | | attribution | true | This option specifies whether to display the "Powered by Google Translate" attribution. The default value is true. |

👍 Contribute

If you want to say thank you and/or support the active development this project:

  1. Add a GitHub Star to the project.
  2. Tweet about the project on your Twitter.
  3. Write a review or tutorial on Medium, Dev.to or personal blog.
  4. Support the project by donating a cup of coffee.

☕ Supporters

If you want to support Svelte Google Translate, you can ☕ buy a coffee here

Author

⚠️ Copyright and license

Code and documentation copyright 2020-2030 the Authors and Code released under the MIT License. Docs released under Creative Commons.

Test Locally

npm run dev