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 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-bootstrap-locale-dialog

v1.2.3

Published

Locale selector dialog for angular-bootstrap

Downloads

22

Readme

Angular Bootstrap Locale Dialog - Locale selector dialog for angular-bootstrap - https://sharvit.github.io/angular-bootstrap-locale-dialog/

Build Status Dependency Status devDependency Status codecov.io

Quick links

Demo

Do you want to see dialog in action? Visit https://sharvit.github.io/angular-bootstrap-locale-dialog/!

Installation

Installation is easy as angular-bootstrap-locale-dialog has minimal dependencies - only the AngularJS and AngularUI Bootstrap are required.

Additionally, it is recommended to use some other dependencies:

Download the build

Install with NPM

$ npm install angular-bootstrap-locale-dialog --save

This will install AngularJS and AngularUI Bootstrap NPM packages.

Install with Bower

$ bower install angular-bootstrap-locale-dialog --save

This will install AngularJS and AngularUI Bootstrap bower packages.

Manual download

All the build files for all version can manually downloaded (or better yet, referencing them from the CDN): https://sharvit.github.io/angular-bootstrap-locale-dialog//angular-bootstrap-locale-dialog-v1.2.3.js

Adding dependency to your project

When you are done downloading all the dependencies and project files the only remaining part is to add dependencies on the angular-bootstrap-locale-dialog AngularJS module:

angular.module('myModule', [
    'ui.bootstrap',
    'ui.bootstrap.locale-dialog'
]);

Usage

<div ng-controller="DemoController as vm">
    <button ng-click="vm.changeLocale()" type="button" class="btn btn-primary">
        Open a Demo Dialog
    </button>
    <p ng-show="vm.selectedLocale">
        You selected: {{vm.selectedLocale}}
    </p>
</div>
angular.module('demo')
.constant("avilableLocales", {
    "en-US": {
        "name": "English (US)",
        "language": "en",
        "country": "us"
    },
    "en-CA": {
        "name": "English (CA)",
        "language": "en",
        "country": "ca"
    },
    "en-GB": {
        "name": "English (GB)",
        "language": "en",
        "country": "gb"
    },
    "en-IN": {
        "name": "English (IN)",
        "language": "en",
        "country": "in"
    },
    "en-IE": {
        "name": "English (IE)",
        "language": "en",
        "country": "ie"
    },
    "fr-FR": {
        "name": "Fran\u00e7ais (FR)",
        "language": "fr",
        "country": "fr"
    },
    "fr-BE": {
        "name": "Fran\u00e7ais (BE)",
        "language": "fr",
        "country": "be"
    },
    "fr-CA": {
        "name": "Fran\u00e7ais (CA)",
        "language": "fr",
        "country": "ca"
    },
    "fr-LB": {
        "name": "Fran\u00e7ais (LB)",
        "language": "fr",
        "country": "lb"
    },
    "he-IL": {
        "name": "\u05e2\u05d1\u05e8\u05d9\u05ea",
        "language": "he",
        "country": "il"
    },
    "pt-BR": {
        "name": "Português (BR)",
        "language": "pt",
        "country": "br"
    },
    "pt-PT": {
        "name": "Português (PT)",
        "language": "pt",
        "country": "pt"
    },
    "ro-RO": {
        "name": "Română",
        "language": "ro",
        "country": "ro"
    },
    "ru-RU": {
        "name": "Русский",
        "language": "ru",
        "country": "ru"
    },
    "sk-SK": {
        "name": "Slovenčina (SK)",
        "language": "sk",
        "country": "sk"
    },
    "tr-TR": {
        "name": "Türkçe",
        "language": "tr",
        "country": "tr"
    },
    "de-DE": {
        "name": "Deutsch (German)",
        "language": "de",
        "country": "de"
    },
    "th-TH": {
        "name": "ภาษาไทย",
        "language": "th",
        "country": "th"
    }
})
.controller('DemoController', function ($localeSelectorDialog, avilableLocales) {
    var vm = this;

    vm.changeLocale = function () {
        $localeSelectorDialog.open({
            locales: avilableLocales,
            showFlags: true,
            showSearch: true,
            contributeUrl: 'https://sharvit.github.io/angular-bootstrap-locale-dialog/'
        }).result.then(function (selectedLocale) {
            vm.selectedLocale = selectedLocale;
        });
    };
});

$localeSelectorDialog is a service to open the locale selector dialog. It based on AngularUI Bootstrap $uibModal witch can create modal windows.

The $localeSelectorDialog service has only one method: open(options).

$localeSelectorDialog's open function

options parameter

  • locales (Type: object, Default: {}) - An object with all the supported locales of your app. The keys inside the object should be your locale id, for example: en-US The value for each key should fill the following requirements:

    • name (Type: string) - The locale readable name, for example English (US)

    • language (Type: string) - The language key, for example en

    • country (Type: string) - The country key, for example us

    Their is an example for the locale object at the demo.

  • templateUrl (Type: string, Default: angular-bootstrap-locale-dialog/angular-bootstrap-locale-dialog.html) - A path to a template representing modal's content. Use it if you don't want to use the default template.

  • showFlags (Type: boolean, Default: false) - Set to true to show flags next to the locale name. Need to install flag-icon-css so it will match the css to the flag icon.

  • showSearch (Type: boolean, Default: false) - Set to true to show the search field. Useful when you have a big list of locales.

  • contributeUrl (Type: string, Default: null) - Have a contribute url that your users can help localize your app? Set it in order to show contribute box with that url.


return

The open method returns the $uibModal modal instance and use his promise to let you know when the dialog is getting closed and what locale did the user choose. You can get the selected locale from the result property of the returned $uibModal modal instance. See the example. [read more about the $uibModal]

Contributing

  • npm install && npm install -g gulp to install the environment
  • gulp build build the component, the docs and the demo
  • gulp serve serve the demo
  • gulp test test the component with karama

License

MIT License (MIT)

Copyright (c) 2015 Avi Sharvit