public static Map<String, String> resolveMessagesForTemplate(final Locale locale,
        ThemeContext theme) {

        // Compute all the resource names we should use: *_gl_ES-gheada.properties, *_gl_ES
        // .properties, _gl.properties...
        // The order here is important: as we will let values from more specific files
        // overwrite those in less specific,
        // (e.g. a value for gl_ES will have more precedence than a value for gl). So we will
        // iterate these resource
        // names from less specific to more specific.
        final List<String>
            messageResourceNames = computeMessageResourceNamesFromBase(locale);

        // Build the combined messages
        Map<String, String> combinedMessages = null;
        for (final String messageResourceName : messageResourceNames) {
            try {
                final Reader messageResourceReader = messageReader(messageResourceName, theme);
                if (messageResourceReader != null) {

                    final Properties messageProperties =
                        readMessagesResource(messageResourceReader);
                    if (messageProperties != null && !messageProperties.isEmpty()) {

                        if (combinedMessages == null) {
                            combinedMessages = new HashMap<>(20);
                        }

                        for (final Map.Entry<Object, Object> propertyEntry :
                            messageProperties.entrySet()) {
                            combinedMessages.put((String) propertyEntry.getKey(),
                                (String) propertyEntry.getValue());
                        }

                    }

                }

            } catch (final IOException ignored) {
                // File might not exist, simply try the next one
            }
        }

        if (combinedMessages == null) {
            return EMPTY_MESSAGES;
        }

        return Collections.unmodifiableMap(combinedMessages);
    }
@Test
    void resolveMessagesForTemplateForDefault() throws URISyntaxException {
        Map<String, String> properties =
            ThemeMessageResolutionUtils.resolveMessagesForTemplate(Locale.CHINESE, getTheme());
        assertThat(properties).hasSize(1);
        assertThat(properties).containsEntry("index.welcome", "欢迎来到首页");
    }