package com.imprimelibros.erp.i18n;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.MessageSource;
import org.springframework.stereotype.Component;

import java.util.*;

@Component
public class TranslationService {

    @Autowired
    private MessageSource messageSource;

    public Map<String, String> getTranslations(Locale locale, List<String> keys) {
        Map<String, String> translations = new HashMap<>();
        for (String key : keys) {
            translations.put(key, messageSource.getMessage(key, null, locale));
        }
        return translations;
    }
}
