001package com.nimbusds.langtag;
002
003
004/**
005 * Read-only view of a {@link LangTag Language tag}.
006 */
007public interface ReadOnlyLangTag {
008        
009        
010        /**
011         * Gets the language (primary language plus extended language subtags).
012         *
013         * <p>See RFC 5646 section 2.2.1.
014         *
015         * <p>Examples:
016         *
017         * <pre>
018         * en
019         * de
020         * zh-cmn
021         * cmn
022         * </pre>
023         *
024         * @return The language, consisting of the primary and/or extended 
025         *         language subtags.
026         */
027        public String getLanguage();
028        
029        
030        /**
031         * Gets the primary language.
032         *
033         * <p>See RFC 5646 section 2.2.1.
034         *
035         * @return The primary language, as a two or three-letter ISO 639 code,
036         *         in canonical lower case format.
037         */
038        public String getPrimaryLanguage();
039        
040        
041        /**
042         * Gets the extended language subtags.
043         *
044         * <p>See RFC 5646 section 2.2.2.
045         *
046         * @return The extended language subtags, as three-letter ISO 639-3 
047         *         codes. {@code null} if none.
048         */
049        public String[] getExtendedLanguageSubtags();
050        
051        
052        /**
053         * Gets the script.
054         *
055         * <p>See RFC 5646 section 2.2.3.
056         *
057         * @return The script, as an ISO 15924 code, in canonical title case
058         *         format. {@code null} if not defined.
059         */
060        public String getScript();
061        
062        
063        /**
064         * Gets the region.
065         *
066         * <p>See RFC 5646 section 2.2.4.
067         *
068         * @return The region, as a two-letter ISO 3166-1 code or a three-digit
069         *         UN M.49 code. {@code null} if not defined.
070         */
071        public String getRegion();
072        
073        
074        /**
075         * Gets the variants.
076         *
077         * <p>See RFC 5646 section 2.2.5.
078         *
079         * @return The variants. {@code null} if not defined.
080         */
081        public String[] getVariants();
082        
083        
084        /**
085         * Gets the extensions.
086         *
087         * <p>See RFC 5646 section 2.2.6.
088         *
089         * @return The extensions. {@code null} if not defined.
090         */
091        public String[] getExtensions();
092        
093        
094        /**
095         * Gets the private use.
096         *
097         * <p>See RFC 5646 section 2.2.7.
098         *
099         * @return The private use. {@code null} if not defined.
100         */
101        public String getPrivateUse();
102        
103        
104        /**
105         * Returns the canonical string representation of this language tag.
106         *
107         * @return The canonical string representation.
108         */
109        public String toString();
110}