Ofcas.Framework.Translation.Core 3.0.17

Translation.Core

Target Framework

  • .NET Standard Version 2.0

Supported Version

  • .NET und .NET Core 2.0, 2.1, 2.2, 3.0, 3.1, 5.0, 6.0, 7.0, 8.0, 9.0
  • .NET Framework 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

Deployment

Project used nuget build workflow. https://bamboo.orgadata.com/browse/NF-TRANSREL

Supported File-Format

  • .Dat-Format or .lProj-Format

Interfaces

TranslationFactoryOptions

  • SourceCodeCulture (Set standard culture that be used in code)
  • TranslationDirectoryPath (Set directory for translationdatas)

ITranslationFactory

  • CreateLanguageProvider
  • CreateTranslationsProvider
  • CreateTranslationAccessor(isoCode, fallbacklanguages)

ILanguageProvider

  • GetLanguages (Get a list from supported languages in your selected folder)
  • GetByIsoCode (Get a specific language by iso code)

ITranslationProvider

  • GetTranslationAccessor (Get a accessor for your selected language or fallbacklanguage)

ITranslationObserver

  • TranslationSucessful (that can be used if the translation was succesfull)
  • TranslationFailed (that can be used if the translation was failed)

ITranslationAccessor

  • Tx (translation call for your text with specific ids)
  • GetTranslationByIdentifiers (Return translation by specific ids)
  • Attach (Add ITranslationObserver)
  • Detach (Remove ITranslationObserver)
  • LoggingTranslationCalls (Create new "TranslationProtocoll", can be Attach/Detach with parameter)

Quick Start

Create translationaccessor:

  • Create translationfactory
  • CreateTranslationAccessor with your IsoCode (fallbacklanguages)
  • Use TranslationAccessor.tx for your translationcall

or

Use GlobalTranslation:

  • Use Init with your translation folder
  • Get an Instance with your selected language isocode
  • Use GlobalTranslation.Instance.tx for your translationcall

Usage

  • Create a TranslationFactoryOptions for SourceCodeCulture and your Translation directory and added to TranslationFactory
var factoryoptions = new TranslationFactoryOptions();

factoryoptions.TranslationDirectoryPath = "../translation"
factoryoptions.SourceCodeCulture = CultureInfo.GetCultureInfo("en");

var translationFactory = new TranslationFactory(_factoryoptions);

How to know your supported language

  • Get your languagelist from languageprovider
_languageProvider = _translationFactory.CreateLanguageProvider(); 
_languageProvider.GetLanguages();

How to get translationaccessor:

  • Get your language from languageprovider by isocode
  • Get your accessor with your selected language from GetTranslationAccessor
_languageProvider = _translationFactory.CreateLanguageProvider(); 
_translationProvider = _translationFactory.CreateTranslationsProvider(); 
_translationAccessor =_translationProvider.GetTranslationAccessor(_languageProvider.GetByIsoCode("en"));

How to use for translation:

  • Use accessor tx for your text Tx Parameters:
  • Selected text for translation
  • Selected productId
  • Selected translationIndex for your translation
  • For variable placeholder "#" to replace (These strings are not translated)
myVariable = "Hello"`
_translationAccessor.Tx("Your Text #", 123, 123, myVariable);

or

string _MyTranslationText = _translationAccessor.GetTranslationByIdentifiers(123, 123);

How to use GlobalTranslation:

  • initialize GlobalTranslation with Init(../translationfolder)
  • Use GetInstance with your selected isocode
  • Now you can use GlobalTranslation.Instance to use all function from ITranslationAccessor Urgent: You have to initialize Globaltranslation otherwise it will crash.
GlobalTranslation.Init("../translationfolder");
GlobalTranslation.GetInstance("en");
var value = GlobalTranslation.Instance.Tx("My test text", 123, 456);

How to start logging:

  • Use LoggingTranslationCalls start(True) to attach the TranslationProtocol and start logging translationcalls
  • Use LoggingTranslationCalls start(False) to detach the TranslationProtocol
_translationAccessor.LoggingTranslationCalls(True);
_translationAccessor.Tx("Your Text", 123, 123);
_translationAccessor.Tx("Your Second Text", 456, 456);
_translationAccessor.LoggingTranslationCalls(False);

or

GlobalTranslation.Instance.LoggingTranslationCalls(True);
GlobalTranslation.Instance.Tx("Your Text", 123, 123);
GlobalTranslation.Instance.Tx("Your Second Text", 456, 456);
GlobalTranslation.Instance.LoggingTranslationCalls(False);

Attach/Detach your own TranslationObserver:

ITranslationObserver _MyObserver = new MyObserver();
_translationAccessor.Attach(_MyObserver); 
_translationAccessor.Tx("Your Text", 123, 123);
_translationAccessor.Tx("Your Second Text", 456, 456);
_translationAccessor.Detach(_MyObserver);

Showing the top 20 packages that depend on Ofcas.Framework.Translation.Core.

Packages Downloads
Ofcas.Framework.Translation.AspNetCore
Package Description
49
Ofcas.Framework.Translation.AspNetCore
Package Description
30
Ofcas.Framework.Translation.AspNetCore
Package Description
29
Ofcas.Framework.Translation.AspNetCore
Package Description
10

.NET Standard 2.0

Version Downloads Last updated
3.0.17 16 10/30/2026
3.0.11 71 10/04/2025
3.0.10 27 10/04/2025
3.0.9 28 10/04/2025
3.0.8 42 10/04/2025