Base solution for your next web application
Open Closed

Localization #2708


User avatar
0
fourier created

I created the purchased product as: MultiTennant_MVC. Afterwards I changed all the names, namespaces etc. in Visual Studio to: MultiTenant_MVC First name was spelled incorrectly with 2 n’s.

Now the language translations are not done – everything is displayed with the [ ] brackets and always in english.

What should I change?


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Probably you need to change the namespace used when addding the localization source. Check the class under Localization folder of your Core project and change the namespace according to your new namespace.

  • User Avatar
    0
    fourier created

    Properties for Core project: Assembly name: FS.MultiTenant_MVC.Core Default namespace: FS.MultiTenant_MVC

    Localization folder has folder called MultiTenant_MVC with the xml files like: MultiTenant_MVC.xml, MultiTenant_MVC-de.xml etc.

    Constants: namespace FS.MultiTenant_MVC { /// <summary> /// Some general constants for the application. /// </summary> public class MultiTenant_MVCConsts { public const string LocalizationSourceName = "MultiTenant_MVC"; } }

    So everything here looks fine but I get this error when running the app and then view debug using F12: Could not find localization source: MultiTenant_MVC

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Can you check for usages of "MultiTenant_MVCConsts.LocalizationSourceName". Yo can find where it is used to add a localization source. There must be a similar code like this:

    localizationConfiguration.Sources.Add(
        new DictionaryBasedLocalizationSource(MzCoreConsts.LocalizationSourceName,
            new XmlEmbeddedFileLocalizationDictionaryProvider(
                Assembly.GetExecutingAssembly(),
                "Volo.MzCore.Localization.SourceFiles"
            )
        )
    );
    
  • User Avatar
    0
    fourier created

    //Add/remove localization sources Configuration.Localization.Sources.Add( new DictionaryBasedLocalizationSource( "MultiTenant_MVC", new XmlEmbeddedFileLocalizationDictionaryProvider( Assembly.GetExecutingAssembly(), "FS.MultiTenant_MVC.Localization.MultiTenant_MVC" ) ) );

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I thought this full namespace "FS.MultiTenant_MVC.Localization.MultiTenant_MVC" is wrong but it does not contain double n in it. If you cannot solve the problem, can you send your project to <a href="mailto:[email protected]">[email protected]</a>, we will solve it for you.

    Thanks.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thank you for sending the project. You need to change adding localization source code like this:

    //Add/remove localization sources
    Configuration.Localization.Sources.Add(
        new DictionaryBasedLocalizationSource(
            MultiTenant_MVCConsts.LocalizationSourceName,
            new XmlEmbeddedFileLocalizationDictionaryProvider(
                Assembly.GetExecutingAssembly(),
                "FS.MultiTenant_MVC.Localization.MultiTenant_MVC"
                )
            )
        );
    

    Also you need to change localization xml files to embeded resource. This way it will work.

    Thanks.