#ifndef TRANSLATOR_ADAPTER_H
#define TRANSLATOR_ADAPTER_H

#include "version.h"
#include "translator.h"

/** Base of the translator adapter tree.
 *
 *  This abstract class provides access to the english
 *  translations, to be used as a substitute for not implemented
 *  local translations.
 */
class TranslatorAdapterBase : public Translator
{
  protected:
    TranslatorEnglish english;

    /*! An auxiliary inline method used by the updateNeededMessage()
     *  for building a warning message.
     */
    inline OGString createUpdateNeededMessage(const OGString & languageName,
                                              const OGString & versionString)
    {
      return OGString("The selected output language \"")
             + languageName
             + "\" has not been updated\nsince "
             + versionString
             + ".  As a result some sentences may appear in English.\n\n";
    }
  public:
    /*! This method is used to generate a warning message to signal
     *  the user that the translation of his/her language of choice
     *  needs updating.  It must be implemented by the translator
     *  adapter class (pure virtual).
     *
     *  \sa createUpdateNeededMessage()
     */
    virtual OGString updateNeededMessage() override = 0;
};

class TranslatorAdapter_1_11_0 : public TranslatorAdapterBase
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.11.0"); }
    OGString trImportant() override
    { return english.trImportant(); }
};

class TranslatorAdapter_1_10_0 : public TranslatorAdapter_1_11_0
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.10.0"); }
    OGString trCopyToClipboard() override
    { return english.trCopyToClipboard(); }
};

class TranslatorAdapter_1_9_8 : public TranslatorAdapter_1_10_0
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.9.8"); }

    OGString trTopics() override
    { return english.trTopics(); }
    OGString trTopicDocumentation() override
    { return english.trTopicDocumentation(); }
    OGString trTopicList() override
    { return english.trTopicList(); }
    OGString trTopicIndex() override
    { return english.trTopicIndex(); }
    OGString trTopicListDescription() override
    { return english.trTopicListDescription(); }
    OGString trModuleMembersDescriptionTotal(ModuleMemberHighlight::Enum hl) override
    { return english.trModuleMembersDescriptionTotal(hl); }
    OGString trExportedModules() override
    { return english.trExportedModules(); }

};

class TranslatorAdapter_1_9_6 : public TranslatorAdapter_1_9_8
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.9.6"); }

    /*! Small trick to use the original functions as the wording has been changed */
    OGString trRelatedSymbols() override
    { return trRelatedFunctions(); }
    OGString trRelatedSymbolsSubscript() override
    { return trRelatedSubscript(); }
    OGString trRelatedSymbolDocumentation() override
    { return trRelatedFunctionDocumentation(); }

    OGString trCompoundType(ClassDef::CompoundType compType, SrcLangExt lang) override
    { return english.trCompoundType(compType, lang); }

    OGString trFileMembersDescriptionTotal(FileMemberHighlight::Enum hl) override
    {
      if (hl==FileMemberHighlight::All)
      {
        return trFileMembersDescription(Config_getBool(EXTRACT_ALL));
      }
      else
      {
        // hack to work around a mozilla bug, which refuses to switch to
        // normal lists otherwise
        return "&nbsp;";
      }
    }
    OGString trCompoundMembersDescriptionTotal(ClassMemberHighlight::Enum hl) override
    {
      if (hl==ClassMemberHighlight::All)
      {
        return trCompoundMembersDescription(Config_getBool(EXTRACT_ALL));
      }
      else
      {
        // hack to work around a mozilla bug, which refuses to switch to
        // normal lists otherwise
        return "&nbsp;";
      }
    }
    OGString trNamespaceMembersDescriptionTotal(NamespaceMemberHighlight::Enum hl) override
    {
      if (hl==NamespaceMemberHighlight::All)
      {
        return trNamespaceMemberDescription(Config_getBool(EXTRACT_ALL));
      }
      else
      {
        // hack to work around a mozilla bug, which refuses to switch to
        // normal lists otherwise
        return "&nbsp;";
      }
    }

    OGString trDefinition() override
    { return english.trDefinition(); }
    OGString trDeclaration() override
    { return english.trDeclaration(); }
};

class TranslatorAdapter_1_9_5 : public TranslatorAdapter_1_9_6
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.9.5"); }

    OGString trFlowchart() override
    { return english.trFlowchart(); }
};

class TranslatorAdapter_1_9_4 : public TranslatorAdapter_1_9_5
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.9.4"); }

    OGString trPackageList() override
    { return english.trPackageList(); }
};

class TranslatorAdapter_1_9_2 : public TranslatorAdapter_1_9_4
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.9.2"); }

    OGString trConcept(bool first_capital,bool singular) override
    { return english.trConcept(first_capital,singular); }

    OGString trConceptReference(const OGString &conceptName) override
    { return english.trConceptReference(conceptName); }

    OGString trConceptList() override
    { return english.trConceptList(); }

    OGString trConceptIndex() override
    { return english.trConceptIndex(); }

    OGString trConceptDocumentation() override
    { return english.trConceptDocumentation(); }

    OGString trConceptListDescription(bool extractAll) override
    { return english.trConceptListDescription(extractAll); }

    OGString trConceptDefinition() override
    { return english.trConceptDefinition(); }
};

class TranslatorAdapter_1_8_19 : public TranslatorAdapter_1_9_2
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.8.19"); }

    OGString trDesignUnitDocumentation() override
    { return english.trDesignUnitDocumentation(); }
};

class TranslatorAdapter_1_8_15 : public TranslatorAdapter_1_8_19
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.8.15"); }

    OGString trDesignUnitHierarchy() override
    { return english.trDesignUnitHierarchy(); }

    OGString trDesignUnitList() override
    { return english.trDesignUnitList(); }

    OGString trDesignUnitMembers() override
    { return english.trDesignUnitMembers(); }

    OGString trDesignUnitListDescription() override
    { return english.trDesignUnitListDescription(); }

    OGString trDesignUnitIndex() override
    { return english.trDesignUnitIndex(); }

    OGString trDesignUnits() override
    { return english.trDesignUnits(); }

    OGString trFunctionAndProc() override
    { return english.trFunctionAndProc(); }

    OGString trVhdlType(VhdlSpecifier type,bool single) override
    { return english.trVhdlType(type,single); }

    OGString trCustomReference(const OGString &name) override
    { return english.trCustomReference(name); }

    OGString trConstants() override
    { return english.trConstants(); }

    OGString trConstantDocumentation() override
    { return english.trConstantDocumentation(); }

    OGString trSequences() override
    { return english.trSequences(); }

    OGString trSequenceDocumentation() override
    { return english.trSequenceDocumentation(); }

    OGString trDictionaries() override
    { return english.trDictionaries(); }

    OGString trDictionaryDocumentation() override
    { return english.trDictionaryDocumentation(); }

    OGString trSliceInterfaces() override
    { return english.trSliceInterfaces(); }

    OGString trInterfaceIndex() override
    { return english.trInterfaceIndex(); }

    OGString trInterfaceList() override
    { return english.trInterfaceList(); }

    OGString trInterfaceListDescription() override
    { return english.trInterfaceListDescription(); }

    OGString trInterfaceHierarchy() override
    { return english.trInterfaceHierarchy(); }

    OGString trInterfaceHierarchyDescription() override
    { return english.trInterfaceHierarchyDescription(); }

    OGString trInterfaceDocumentation() override
    { return english.trInterfaceDocumentation(); }

    OGString trStructs() override
    { return english.trStructs(); }

    OGString trStructIndex() override
    { return english.trStructIndex(); }

    OGString trStructList() override
    { return english.trStructList(); }

    OGString trStructListDescription() override
    { return english.trStructListDescription(); }

    OGString trStructDocumentation() override
    { return english.trStructDocumentation(); }

    OGString trExceptionIndex() override
    { return english.trExceptionIndex(); }

    OGString trExceptionList() override
    { return english.trExceptionList(); }

    OGString trExceptionListDescription() override
    { return english.trExceptionListDescription(); }

    OGString trExceptionHierarchy() override
    { return english.trExceptionHierarchy(); }

    OGString trExceptionHierarchyDescription() override
    { return english.trExceptionHierarchyDescription(); }

    OGString trExceptionDocumentation() override
    { return english.trExceptionDocumentation(); }

    OGString trCompoundReferenceSlice(const OGString &clName, ClassDef::CompoundType compType, bool isLocal) override
    { return english.trCompoundReferenceSlice(clName,compType,isLocal); }

    OGString trOperations() override
    { return english.trOperations(); }

    OGString trOperationDocumentation() override
    { return english.trOperationDocumentation(); }

    OGString trDataMembers() override
    { return english.trDataMembers(); }

    OGString trDataMemberDocumentation() override
    { return english.trDataMemberDocumentation(); }
};

class TranslatorAdapter_1_8_4 : public TranslatorAdapter_1_8_15
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.8.4"); }

    OGString trInterfaces() override
    { return english.trInterfaces(); }

    OGString trServices() override
    { return english.trServices(); }

    OGString trConstantGroups() override
    { return english.trConstantGroups(); }

    OGString trConstantGroupReference(const OGString &namespaceName) override
    { return english.trConstantGroupReference(namespaceName); }

    OGString trServiceReference(const OGString &sName) override
    { return english.trServiceReference(sName); }

    OGString trSingletonReference(const OGString &sName) override
    { return english.trSingletonReference(sName); }

    OGString trServiceGeneratedFromFiles(bool single) override
    { return english.trServiceGeneratedFromFiles(single); }

    OGString trSingletonGeneratedFromFiles(bool single) override
    { return english.trSingletonGeneratedFromFiles(single); }
};

class TranslatorAdapter_1_8_2 : public TranslatorAdapter_1_8_4
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.8.2"); }

    OGString trPanelSynchronisationTooltip(bool enable) override
    { return english.trPanelSynchronisationTooltip(enable); }

    OGString trProvidedByCategory() override
    { return english.trProvidedByCategory(); }

    OGString trExtendsClass() override
    { return english.trExtendsClass(); }

    OGString trClassMethods() override
    { return english.trClassMethods(); }

    OGString trInstanceMethods() override
    { return english.trInstanceMethods(); }

    OGString trMethodDocumentation() override
    { return english.trMethodDocumentation(); }
};


/** Adapter class for languages that only contain translations up to
 *  version 1.8.0.
 */
class TranslatorAdapter_1_8_0 : public TranslatorAdapter_1_8_2
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.8.0"); }

    OGString trDetailLevel() override
    { return english.trDetailLevel(); }

    OGString trTemplateParameters() override
    { return english.trTemplateParameters(); }

    OGString trAndMore(const OGString &number) override
    { return english.trAndMore(number); }

    OGString trEnumGeneratedFromFiles(bool single) override
    { return english.trEnumGeneratedFromFiles(single); }

    OGString trEnumReference(const OGString &name) override
    { return english.trEnumReference(name); }

    OGString trInheritedFrom(const OGString &members,const OGString &what) override
    { return english.trInheritedFrom(members,what); }

    OGString trAdditionalInheritedMembers() override
    { return english.trAdditionalInheritedMembers(); }

};

/** Adapter class for languages that only contain translations up to
 *  version 1.7.5.
 */
class TranslatorAdapter_1_7_5 : public TranslatorAdapter_1_8_0
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.7.5"); }

    OGString trCiteReferences() override
    { return english.trCiteReferences(); }

    OGString trCopyright() override
    { return english.trCopyright(); }

    OGString trDirDepGraph(const OGString &name) override
    { return english.trDirDepGraph(name); }

    OGString trFileIn(const OGString &name) override
    { return english.trFileIn(name); }
    OGString trIncludesFileIn(const OGString &name) override
    { return english.trIncludesFileIn(name); }
    OGString trDateTime(int year,int month,int day,int dayOfWeek,
                                int hour,int minutes,int seconds,
                                DateTimeType includeTime) override
    { return english.trDateTime(year,month,day,dayOfWeek,hour,minutes,seconds,includeTime); }
    OGString trDayPeriod(bool period) override
    { return english.trDayPeriod(period); }

};

/** Adapter class for languages that only contain translations up to
 *  version 1.6.0.
 */
class TranslatorAdapter_1_6_0 : public TranslatorAdapter_1_7_5
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.6.0"); }

    OGString trDirRelation(const OGString &name) override
    { return english.trDirRelation(name); }

    OGString trLoading() override
    { return english.trLoading(); }

    OGString trGlobalNamespace() override
    { return english.trGlobalNamespace(); }

    OGString trSearching() override
    { return english.trSearching(); }

    OGString trNoMatches() override
    { return english.trNoMatches(); }

    OGString trMemberFunctionDocumentationFortran() override
    { return english.trMemberFunctionDocumentationFortran(); }

    OGString trCompoundListFortran() override
    { return english.trCompoundListFortran(); }

    OGString trCompoundMembersFortran() override
    { return english.trCompoundMembersFortran(); }

    OGString trCompoundListDescriptionFortran() override
    { return english.trCompoundListDescriptionFortran(); }

    OGString trCompoundMembersDescriptionFortran(bool extractAll) override
    { return english.trCompoundMembersDescriptionFortran(extractAll); }

    OGString trCompoundIndexFortran() override
    { return english.trCompoundIndexFortran(); }

    OGString trTypeDocumentation() override
    { return english.trTypeDocumentation(); }

    OGString trSubprograms() override
    { return english.trSubprograms(); }

    OGString trSubprogramDocumentation() override
    { return english.trSubprogramDocumentation(); }

    OGString trDataTypes() override
    { return english.trDataTypes(); }

    OGString trModulesList() override
    { return english.trModulesList(); }

    OGString trModulesListDescription(bool extractAll) override
    { return english.trModulesListDescription(extractAll); }

    OGString trCompoundReferenceFortran(const OGString &clName,
                                 ClassDef::CompoundType compType,
                                 bool isTemplate) override
    { return english.trCompoundReferenceFortran(clName,compType,isTemplate); }

    OGString trModuleReference(const OGString &namespaceName) override
    { return english.trModuleReference(namespaceName); }

    OGString trModulesMembers() override
    { return english.trModulesMembers(); }

    OGString trModulesMemberDescription(bool extractAll) override
    { return english.trModulesMemberDescription(extractAll); }

    OGString trModulesIndex() override
    { return english.trModulesIndex(); }

    OGString trModule(bool first_capital, bool singular) override
    { return english.trModule(first_capital,singular); }

    OGString trGeneratedFromFilesFortran(ClassDef::CompoundType compType,
                     bool single) override
    { return english.trGeneratedFromFilesFortran(compType,single); }

    OGString trType(bool first_capital, bool singular) override
    { return english.trType(first_capital,singular); }

    OGString trSubprogram(bool first_capital, bool singular) override
    { return english.trSubprogram(first_capital,singular); }

    OGString trTypeConstraints() override
    { return english.trTypeConstraints(); }
};

/** Adapter class for languages that only contain translations up to
 *  version 1.4.6
 */
class TranslatorAdapter_1_4_6 : public TranslatorAdapter_1_6_0
{
  public:
    OGString updateNeededMessage() override
    { return createUpdateNeededMessage(idLanguage(),"release 1.4.6"); }
    OGString trCallerGraph() override
    { return english.trCallerGraph(); }
    OGString trEnumerationValueDocumentation() override
    { return english.trEnumerationValueDocumentation(); }
};

#endif
