~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/static/jslibs/yui/3.4.1/build/intl-base/intl-base-debug.js

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
YUI 3.4.1 (build 4118)
3
 
Copyright 2011 Yahoo! Inc. All rights reserved.
4
 
Licensed under the BSD License.
5
 
http://yuilibrary.com/license/
6
 
*/
7
 
YUI.add('intl-base', function(Y) {
8
 
 
9
 
/**
10
 
 * The Intl utility provides a central location for managing sets of
11
 
 * localized resources (strings and formatting patterns).
12
 
 *
13
 
 * @class Intl
14
 
 * @uses EventTarget
15
 
 * @static
16
 
 */
17
 
 
18
 
var SPLIT_REGEX = /[, ]/;
19
 
 
20
 
Y.mix(Y.namespace('Intl'), {
21
 
 
22
 
 /**
23
 
    * Returns the language among those available that
24
 
    * best matches the preferred language list, using the Lookup
25
 
    * algorithm of BCP 47.
26
 
    * If none of the available languages meets the user's preferences,
27
 
    * then "" is returned.
28
 
    * Extended language ranges are not supported.
29
 
    *
30
 
    * @method lookupBestLang
31
 
    * @param {String[] | String} preferredLanguages The list of preferred
32
 
    * languages in descending preference order, represented as BCP 47
33
 
    * language tags. A string array or a comma-separated list.
34
 
    * @param {String[]} availableLanguages The list of languages
35
 
    * that the application supports, represented as BCP 47 language
36
 
    * tags.
37
 
    *
38
 
    * @return {String} The available language that best matches the
39
 
    * preferred language list, or "".
40
 
    * @since 3.1.0
41
 
    */
42
 
    lookupBestLang: function(preferredLanguages, availableLanguages) {
43
 
 
44
 
        var i, language, result, index;
45
 
 
46
 
        // check whether the list of available languages contains language;
47
 
        // if so return it
48
 
        function scan(language) {
49
 
            var i;
50
 
            for (i = 0; i < availableLanguages.length; i += 1) {
51
 
                if (language.toLowerCase() ===
52
 
                            availableLanguages[i].toLowerCase()) {
53
 
                    return availableLanguages[i];
54
 
                }
55
 
            }
56
 
        }
57
 
 
58
 
        if (Y.Lang.isString(preferredLanguages)) {
59
 
            preferredLanguages = preferredLanguages.split(SPLIT_REGEX);
60
 
        }
61
 
 
62
 
        for (i = 0; i < preferredLanguages.length; i += 1) {
63
 
            language = preferredLanguages[i];
64
 
            if (!language || language === '*') {
65
 
                continue;
66
 
            }
67
 
            // check the fallback sequence for one language
68
 
            while (language.length > 0) {
69
 
                result = scan(language);
70
 
                if (result) {
71
 
                    return result;
72
 
                } else {
73
 
                    index = language.lastIndexOf('-');
74
 
                    if (index >= 0) {
75
 
                        language = language.substring(0, index);
76
 
                        // one-character subtags get cut along with the
77
 
                        // following subtag
78
 
                        if (index >= 2 && language.charAt(index - 2) === '-') {
79
 
                            language = language.substring(0, index - 2);
80
 
                        }
81
 
                    } else {
82
 
                        // nothing available for this language
83
 
                        break;
84
 
                    }
85
 
                }
86
 
            }
87
 
        }
88
 
 
89
 
        return '';
90
 
    }
91
 
});
92
 
 
93
 
 
94
 
}, '3.4.1' ,{requires:['yui-base']});