Segment all the pofiles for `locale`.

    Returns a set of filenames, all the segment files written.
258
def segment_pofiles(configuration, locale):
    
    files_written = set()
    for filename, segments in configuration.segment.items():
        filename = configuration.get_messages_dir(locale) / filename
        files_written.update(segment_pofile(filename, segments))
    return files_written
224387
public List<ULocale> getLocales() {
        List<ULocale> result;
        if (locales == null) {
            result = guessLocales();
        } else {
            result = new ArrayList<ULocale>();
            result.addAll(locales);
        }
        return result;
    }
581667
function _extractLocaleDays(abbr, locale) {
      if(abbr) {
        return cldr ? cldr.extractDayNames(locale).format.abbreviated : ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'];
      }
      else {
        return cldr ? cldr.extractDayNames(locale).format.wide : ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'];
      }
    }
1330700
def list_locales(self) -> List[Optional[Text]]:
        

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

        if not locales:
            locales.append(None)

        return locales
586269
def get_local_file_list(self):
        
        file_list = []
        for (dirpath, dirnames, filenames) in os.walk(self.build_dir):
            for fname in filenames:
                # relative path, to sync with the S3 key
                local_key = os.path.join(
                    os.path.relpath(dirpath, self.build_dir),
                    fname
                )
                if local_key.startswith('./'):
                    local_key = local_key[2:]
                file_list.append(local_key)
        return file_list
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;
	}
92632
private function getPostedLocales()
    {
        $localeIDs = [];
        $list = $this->post('translatedLocales');
        if (is_array($list)) {
            $localeIDs = array_merge($localeIDs, $list);
        }
        $list = $this->post('untranslatedLocales');
        if (is_array($list)) {
            $localeIDs = array_merge($localeIDs, $list);
        }
        $repo = $this->app->make(LocaleRepository::class);
        $locales = $repo->getApprovedLocales();
        $result = [];
        foreach ($locales as $locale) {
            if (in_array($locale->getID(), $localeIDs, true)) {
                $result[] = $locale;
            }
        }

        $count = count($result);
        if ($count === 0) {
            throw new UserMessageException(t('Please specify the languages of the .po/.mo files to generate'));
        }
        if ($this->maxLocalesCount && $count > (int) $this->maxLocalesCount) {
            throw new UserMessageException(t('Please specify up to %s languages (you requested %2$s languages)', $this->maxLocalesCount, $count));
        }

        return $result;
    }
229271
function linkLocales() {
    return listFiles('locales')
        .then(filter(test(/^[a-z]{2}(_[A-Z]{2,3})?\.json$/)) & map(path.join('locales', _)))
        .filter(location => fs.readFileAsync(location)
            .then(JSON.parse & is(Object))
            .catchReturn(false))
        .catchReturn([]);
}
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;
    }
175089
protected Collection<Segment> loadSegments() {
    // Ensure log directories are created.
    storage.directory().mkdirs();

    TreeMap<Long, Segment> segments = new TreeMap<>();

    // Iterate through all files in the log directory.
    for (File file : storage.directory().listFiles(File::isFile)) {

      // If the file looks like a segment file, attempt to load the segment.
      if (SegmentFile.isSegmentFile(name, file)) {
        SegmentFile segmentFile = new SegmentFile(file);
        SegmentDescriptor descriptor = new SegmentDescriptor(FileBuffer.allocate(file, SegmentDescriptor.BYTES));

        // Valid segments will have been locked. Segments that resulting from failures during log cleaning will be
        // unlocked and should ultimately be deleted from disk.
        if (descriptor.locked()) {

          // Load the segment.
          Segment segment = loadSegment(descriptor.id(), descriptor.version());

          // If a segment with an equal or lower index has already been loaded, ensure this segment is not superseded
          // by the earlier segment. This can occur due to segments being combined during log compaction.
          Map.Entry<Long, Segment> previousEntry = segments.floorEntry(segment.index());
          if (previousEntry != null) {

            // If an existing descriptor exists with a lower index than this segment's first index, check to determine
            // whether this segment's first index is contained in that existing index. If it is, determine which segment
            // should take precedence based on segment versions.
            Segment previousSegment = previousEntry.getValue();

            // If the two segments start at the same index, the segment with the higher version number is used.
            if (previousSegment.index() == segment.index()) {
              if (segment.descriptor().version() > previousSegment.descriptor().version()) {
                LOGGER.debug("Replaced segment {} with newer version: {} ({})", previousSegment.descriptor().id(), segment.descriptor().version(), segmentFile.file().getName());
                segments.remove(previousEntry.getKey());
                previousSegment.close();
                previousSegment.delete();
              } else {
                segment.close();
                segment.delete();
                continue;
              }
            }
            // If the existing segment's entries overlap with the loaded segment's entries, the existing segment always
            // supersedes the loaded segment. Log compaction processes ensure this is always the case.
            else if (previousSegment.index() + previousSegment.length() > segment.index()) {
              segment.close();
              segment.delete();
              continue;
            }
          }

          // Add the segment to the segments list.
          LOGGER.debug("Found segment: {} ({})", segment.descriptor().id(), segmentFile.file().getName());
          segments.put(segment.index(), segment);

          // Ensure any segments later in the log with which this segment overlaps are removed.
          Map.Entry<Long, Segment> nextEntry = segments.higherEntry(segment.index());
          while (nextEntry != null) {
            if (nextEntry.getValue().index() < segment.index() + segment.length()) {
              segments.remove(nextEntry.getKey());
              nextEntry = segments.higherEntry(segment.index());
            } else {
              break;
            }
          }

          descriptor.close();
        }
        // If the segment descriptor wasn't locked, close and delete the descriptor.
        else {
          LOGGER.debug("Deleting unlocked segment: {}-{} ({})", descriptor.id(), descriptor.version(), segmentFile.file().getName());
          descriptor.close();
          descriptor.delete();
        }
      }
    }

    for (Long segmentId : segments.keySet()) {
      Segment segment = segments.get(segmentId);
      Map.Entry<Long, Segment> previousEntry = segments.floorEntry(segmentId - 1);
      if (previousEntry != null) {
        Segment previousSegment = previousEntry.getValue();
        if (previousSegment.index() + previousSegment.length() - 1 < segment.index()) {
          previousSegment.skip(segment.index() - (previousSegment.index() + previousSegment.length()));
        }
      }
    }

    return segments.values();
  }
556887
public static function getLocales()
    {
        $localeDir     = __DIR__.'/../locales';
        $languageFiles = scandir($localeDir);
        $locales       = [];
        foreach ($languageFiles as $languageFile) {
            if (in_array($languageFile, ['.', '..'])) {
                continue;
            }
            $extensionPos = strpos($languageFile, '.yml');
            if ($extensionPos !== false) {
                $locale    = substr($languageFile, 0, $extensionPos);
                $locales[] = $locale;
            }
        }
        sort($locales);
        return $locales;
    }
831492
public static List<Locale> getLocales(String localeNames) {

        if (localeNames == null) {
            return null;
        }
        return getLocales(CmsStringUtil.splitAsList(localeNames, ','));
    }
1257930
def get_files():
    

    files_root = path.join(path.dirname(__file__), 'files')

    for root, dirs, files in walk(files_root):
        rel_root = path.relpath(root, files_root)

        for file_name in files:
            try:
                f = open(path.join(root, file_name), 'r', encoding='utf-8')
                with f:
                    yield rel_root, file_name, f.read(), True
            except UnicodeError:
                f = open(path.join(root, file_name), 'rb')
                with f:
                    yield rel_root, file_name, f.read(), False
120730
public function translationsFolders()
    {
        $locale = Locale::parseLocale($this->_locale) + ['region' => null];

        $folders = [
            implode('_', [$locale['language'], $locale['region']]),
            $locale['language']
        ];

        $searchPaths = [];

        $localePaths = App::path('Locale');
        if (empty($localePaths) && defined('APP')) {
            $localePaths[] = APP . 'Locale' . DIRECTORY_SEPARATOR;
        }
        foreach ($localePaths as $path) {
            foreach ($folders as $folder) {
                $searchPaths[] = $path . $folder . DIRECTORY_SEPARATOR;
            }
        }

        // If space is not added after slash, the character after it remains lowercased
        $pluginName = Inflector::camelize(str_replace('/', '/ ', $this->_name));
        if (Plugin::isLoaded($pluginName)) {
            $basePath = Plugin::classPath($pluginName) . 'Locale' . DIRECTORY_SEPARATOR;
            foreach ($folders as $folder) {
                $searchPaths[] = $basePath . $folder . DIRECTORY_SEPARATOR;
            }
        }

        return $searchPaths;
    }
912132
private Path[] getMapFiles(FileSystem fs, boolean isLocal)
  throws IOException {
    List<Path> fileList = new ArrayList<Path>();
    if (isLocal) {
      // for local jobs
      for(int i = 0; i < numMaps; ++i) {
        fileList.add(mapOutputFile.getInputFile(i, getTaskID()));
      }
    } else {
      // for non local jobs
      for (FileStatus filestatus : mapOutputFilesOnDisk) {
        fileList.add(filestatus.getPath());
      }
    }
    return fileList.toArray(new Path[0]);
  }
727613
public function segment($locale = null): ?string
    {
        if (is_null($locale)) {
            return $this->activeSegment();
        }

        return ($key = array_search($locale, $this->locales)) ? $key : null;
    }
55445
def _get_local_files(local_dir, pattern=''):
    
    local_files = {}
    
    if pattern:
        cwd = os.getcwd()
        os.chdir(local_dir)
        patterns = pattern.split('|')
        local_list = set([])
        for p in patterns: local_list = local_list | set(glob(p))
        for path in local_list:
            dir, file = os.path.split(path)
            if os.path.isfile(path):
                local_files[dir] = local_files.get(dir,[])+[file]
            elif os.path.isdir(path):
                local_files[file] = local_files.get(dir,[])
        os.chdir(cwd)
    return local_files