@NotNull
  static String getDefaultBaseName(@NotNull final PsiFile file) {
    return CachedValuesManager.getCachedValue(file, new CachedValueProvider<>() {
      @NotNull
      @Override
      public Result<String> compute() {
        return Result.create(computeBaseName(), file);
      }

      private String computeBaseName() {
        final String name = file.getName();

        if (!StringUtil.containsChar(name, '_')) {
          return FileUtilRt.getNameWithoutExtension(name);
        }

        final Matcher matcher = LOCALE_PATTERN.matcher(name);
        final String baseNameWithExtension;

        int matchIndex = 0;
        while (matcher.find(matchIndex)) {
          final MatchResult matchResult = matcher.toMatchResult();
          final String[] splitted = matchResult.group(1).split("_");
          if (splitted.length > 1) {
            final String langCode = splitted[1];
            if (!LOCALES_LANGUAGE_CODES.get().contains(langCode)) {
              matchIndex = matchResult.start(1) + 1;
              continue;
            }
            baseNameWithExtension = name.substring(0, matchResult.start(1)) + name.substring(matchResult.end(1));
            return FileUtilRt.getNameWithoutExtension(baseNameWithExtension);
          }
        }
        baseNameWithExtension = name;
        return FileUtilRt.getNameWithoutExtension(baseNameWithExtension);
      }
    });
  }
@NotNull
  static String getDefaultBaseName(@NotNull final PsiFile file)