Uploaded image for project: 'Opencast'
  1. MH-13090

Configuration Option to disable Specific Languages in AdminUI

    Details

    • Type: Task
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed and reviewed
    • Affects Version/s: 5.2
    • Fix Version/s: None

      Description

      Request for a config option in the config files to exclude certain lanugages from the Admin UI dropdown and available languages list.

      Use case: For China mainland, to show Taiwan Chinese, Traditional flag is legally prohibited.

      Possible approach to this feature: Make the LanguageServiceImpl a managed class and give it a config file that has optional exclude configuration.

      For example: in etc/org.opencastproject.adminui.impl.LanguageServiceImpl.properties

      # Optional param to exclude languages from the admin-UI
      # Add languages to exclude using xx_XX notation, comma separated values
      org.opencastproject.adminui.languages.exclude=en_US,es_ES,fil_PH
      

      Add the filter to the getAvailableLanguages()

      package org.opencastproject.adminui.impl;
      
      /** Default implementation of {@link LanguageService}. */
      public class LanguageServiceImpl implements LanguageService {
      ...
        @Override
        public List<Language> getAvailableLanguages() {
          List<Language> result = new ArrayList<Language>();
          try {
            List<String> files = pathInspector.listFiles(languageFileFolder);
            for (String file : files) {
              // psuedo-code: if file language is in the org.opencastproject.adminui.languages.exclude list skip
              // else add lang to the result
              result.add(new Language(LanguageFileUtil.safelyStripLanguageFromFilename(file)));
            }
          } catch (IllegalPathException e) {
            logger.warn(
                    "The provided path to the folder containing the language files ({}) does not exist! Returning an empty list...",
                    languageFileFolder);
          }
          return result;
        }
      
      

      Sample of compiled language files ready by the LanguageServiceImpl
      modules/admin-ui/src/main/resources/public/org/opencastproject/adminui/languages/
      lang-el_GR.json
      lang-es_ES.json
      lang-gl_ES.json
      lang-pl_PL.json
      lang-tl_PH.json
      lang-zh_TW.json
      lang-en_GB.json
      lang-fil_PH.json
      lang-he_IL.json
      lang-sl_SI.json
      lang-tr_TR.json
      lang-de_DE.json
      lang-en_US.json
      lang-fr_FR.json
      lang-nl_NL.json
      lang-sv_SE.json
      lang-zh_CN.json

        TestRail: Results

          Attachments

            Activity

              People

              • Assignee:
                greg_logan Greg Logan
                Reporter:
                karen_dolan Karen Dolan
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  TestRail: Cases