You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
946 B

1 month ago
1 month ago
1 month ago
  1. const invariant = require('tiny-invariant');
  2. invariant(
  3. process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE,
  4. 'Default language is not set'
  5. );
  6. if (process.env.NEXT_PUBLIC_ENABLE_MULTI_LANG === 'true') {
  7. invariant(
  8. process.env.NEXT_PUBLIC_AVAILABLE_LANGUAGES,
  9. 'Available language is not set'
  10. );
  11. }
  12. const Config = {
  13. broadcastDriver: process.env.NEXT_PUBLIC_API_BROADCAST_DRIVER ?? 'log',
  14. pusherEnable: process.env.NEXT_PUBLIC_PUSHER_ENABLED ?? 'false',
  15. defaultLanguage: process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE ?? 'en',
  16. availableLanguages: process.env.NEXT_PUBLIC_AVAILABLE_LANGUAGES
  17. ? process.env.NEXT_PUBLIC_AVAILABLE_LANGUAGES.split(',')
  18. : [],
  19. enableMultiLang: process.env.NEXT_PUBLIC_ENABLE_MULTI_LANG === 'true',
  20. rtlLanguages: ['ar', 'fa', 'he'],
  21. getDirection: (language) => {
  22. if (!language) return 'ltr';
  23. return Config.rtlLanguages.includes(language) ? 'rtl' : 'ltr';
  24. },
  25. };
  26. module.exports = { Config };