Initializes the locales that can be selected via the language switcher in the bundle editor.
@return the locales for which keys can be edited.
337658
private Collection<Locale> initLocales() {

        Collection<Locale> locales = null;
        switch (m_bundleType) {
            case DESCRIPTOR:
                locales = new ArrayList<Locale>(1);
                locales.add(Descriptor.LOCALE);
                break;
            case XML:
            case PROPERTY:
                locales = OpenCms.getLocaleManager().getAvailableLocales(m_cms, m_resource);
                break;
            default:
                throw new IllegalArgumentException();
        }
        return locales;

    }
290169
public function getAvailableLocales() {

		foreach($this->locales as $id => $l) {
			if(!$l) {
				$this->locales[$id] = new Locale($id);
			}
		}

		return $this->locales;
	}
1067872
public Enumeration getLocales() {
        // 321485
        if (TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINE)) {  //306998.15
            logger.logp(Level.FINE, CLASS_NAME,"getLocales", "this->"+this+": ");
        }
        if (WCCustomProperties.CHECK_REQUEST_OBJECT_IN_USE){
            checkRequestObjectInUse();
        }
        processLocales();
        return new Enumeration() {
            java.util.Iterator iter = _srtRequestHelper._locales.iterator();
            public boolean hasMoreElements() {
                return iter.hasNext();
            }

            public Object nextElement() {
                return iter.next();
            }
        };

    }
530988
String getRemarks() {

        if (!locale_set) {
            setLocale(Locale.getDefault());
        }

        String key = this.getTypeName();

        return BundleHandler.getString(hnd_remarks, key);
    }
819972
private Map<String, String> buildLocalesMap() {

        TreeMap<String, String> localesMap = new TreeMap<String, String>();
        Iterator<Locale> it = OpenCms.getLocaleManager().getAvailableLocales().iterator();
        while (it.hasNext()) {
            Locale locale = it.next();
            localesMap.put(locale.toString(), locale.getDisplayName(getWorkplaceLocale()));
        }
        return localesMap;
    }
1218015
Map<Class<? extends Annotation>, Set<Locale>> getAnnotationToLocaleMapping() {
        Map<Class<? extends Annotation>, Set<Locale>> res = new HashMap<Class<? extends Annotation>, Set<Locale>>();
        for (Entry<Class<? extends Annotation>, C10NAnnotationBinder> entry : annotationBinders.entrySet()) {
            Set<Locale> locales = getLocales(entry.getKey(), res);
            locales.add(entry.getValue().getLocale());
        }
        return res;
    }
227916
Set<Locale> getImplLocales(Class<?> c10nInterface) {
        Set<Locale> res = new HashSet<Locale>();
        C10NImplementationBinder<?> binder = binders.get(c10nInterface);
        if (binder != null) {
            res.addAll(binder.bindings.keySet());
        }
        return res;
    }
1109687
public List<LocaleEncodingMappingListType<WebFragmentType<T>>> getAllLocaleEncodingMappingList()
   {
      List<LocaleEncodingMappingListType<WebFragmentType<T>>> list = new ArrayList<LocaleEncodingMappingListType<WebFragmentType<T>>>();
      List<Node> nodeList = childNode.get("locale-encoding-mapping-list");
      for(Node node: nodeList)
      {
         LocaleEncodingMappingListType<WebFragmentType<T>>  type = new LocaleEncodingMappingListTypeImpl<WebFragmentType<T>>(this, "locale-encoding-mapping-list", childNode, node);
         list.add(type);
      }
      return list;
   }
296895
public List<String> getI18nkeys() {
    	if (i18nkeys == null) {
    		return new ArrayList<String>();
    	}
    	Collections.sort(i18nkeys, new Comparator<String>() {

			@Override
			public int compare(String o1, String o2) {				
				return Collator.getInstance().compare(o1, o2);
			}
		});
		return i18nkeys;
	}
115696
private void initKeySetForXmlBundle() {

        // consider only available locales
        for (Locale l : m_locales) {
            if (m_xmlBundle.hasLocale(l)) {
                Set<Object> keys = new HashSet<Object>();
                for (I_CmsXmlContentValue msg : m_xmlBundle.getValueSequence("Message", l).getValues()) {
                    String msgpath = msg.getPath();
                    keys.add(m_xmlBundle.getStringValue(m_cms, msgpath + "/Key", l));
                }
                m_keyset.updateKeySet(null, keys);
            }
        }

    }
1155284
public Locale getEffectiveLocale() {

		// Priority 5: Default locale
		Locale locale = Locale.getDefault();
		boolean userHasLocaleString = false;

		if (cachedUser != null) {

			// Priority 2: User locale
			final String userLocaleString = cachedUser.getLocale();
			if (userLocaleString != null) {

				userHasLocaleString = true;

				try {
					locale = LocaleUtils.toLocale(userLocaleString);
				} catch (IllegalArgumentException e) {
					locale = Locale.forLanguageTag(userLocaleString);
				}
			}

		}

		if (request != null) {

			if (!userHasLocaleString) {

				// Priority 4: Browser locale
				locale = request.getLocale();

				final Cookie[] cookies = request.getCookies();

				if (cookies != null) {

					// Priority 3: Cookie locale
					for (Cookie c : cookies) {

						if (c.getName().equals(LOCALE_KEY)) {

							final String cookieLocaleString = c.getValue();

							try {
								locale = LocaleUtils.toLocale(cookieLocaleString);
							} catch (IllegalArgumentException e) {
								locale = Locale.forLanguageTag(cookieLocaleString);
							}

						}

					}

				}

			}

			// Priority 1: URL parameter locale
			String requestedLocaleString = request.getParameter(LOCALE_KEY);
			if (StringUtils.isNotBlank(requestedLocaleString)) {
				try {
					locale = LocaleUtils.toLocale(requestedLocaleString);
				} catch (IllegalArgumentException e) {
					locale = Locale.forLanguageTag(requestedLocaleString);
				}
			}

		}

		return locale;
	}
431264
public static Locale getCurrentLocale() {
        final UI currentUI = UI.getCurrent();
        return currentUI == null ? Locale.getDefault() : currentUI.getLocale();
    }
1330700
def list_locales(self) -> List[Optional[Text]]:
        

        locales = list(self.dict.keys())

        if not locales:
            locales.append(None)

        return locales
614497
public static Map<String, String> getSupportedLocales() {
		Map<String, String> locales = new HashMap<String, String>();
		for (String localeName : LocaleInfo.getAvailableLocaleNames()) {
			String displayName = LocaleInfo.getLocaleNativeDisplayName(localeName);
			locales.put(localeName, displayName);
		}
		return locales;
	}
706384
public function getDisplayLocales()
    {
        $locales = array();

        foreach ($this->allowedLocales as $locale) {
            $locales[$locale] = \Locale::getDisplayName($locale);
        }

        return $locales;
    }
627637
private boolean removeKeyForAllLanguages(String key) {

        try {
            if (hasDescriptor()) {
                lockDescriptor();
            }
            loadAllRemainingLocalizations();
            lockAllLocalizations(key);
        } catch (CmsException | IOException e) {
            LOG.warn("Not able lock all localications for bundle.", e);
            return false;
        }
        if (!hasDescriptor()) {

            for (Entry<Locale, SortedProperties> entry : m_localizations.entrySet()) {
                SortedProperties localization = entry.getValue();
                if (localization.containsKey(key)) {
                    localization.remove(key);
                    m_changedTranslations.add(entry.getKey());
                }
            }
        }
        return true;
    }
1056277
public function availableLocales()
    {
        $locales = $this->getCore()->config('locale.translation-locales');

        if (is_array($locales)) {
            return $locales;
        }

        return $this->getLocaleRepository()->getAvailable();
    }