ASP.NET MVC add translation in multiplanguage from screen/UI dynamically - asp.net-mvc

In my website -- Add screen/UI from which user can add translation dynamically
for example:
I want to add translation for "Hello World!" in multiple language and want to fetch according to language selection
Key :
strHelloWorld
Value:
Hello World!
Language:
en (it can be anything english,spanish,german etc)
This above 3 field data we can add/enter from Scree/UI by superadmin and
store/save in whatever form is good it can be in database or in json file
Please suggest way to add translation from screen

Asp.Net has a special file called resource files (.resx) to define the default locale (English) and other language texts.
For that please follow the steps:
step 1: You need to create .resx(resource file) into Resource(new
folder). create the file for the default language and second file with other lang.
step 2: set access modifier to public otherwise the
variable value will not appear on the view side
step 3: enter the variable name in the same in both files but make value different related to language.
step 4: once you declare the same variable name in both languages resource file, you can use that variable name where ever you want to declare in .cshtml file.
ex. Resources.Global.APP_NAME
For reference :
http://www.codedigest.com/posts/53/create-multi-language-website-in-aspnet-mvc---localization

Please use below nuget package
It is really awesome thanks to nuget and their author
https://github.com/RickStrahl/Westwind.Globalization
Please note that In this solution they have provided solution for all .net framwork/platform like asp.net 4.5 also aspnet core
Thanks again

Related

Not apply .po files for module in Orchard CMS

I install Orchard CMS 1.10 and take russian translate from https://crowdin.com/project/orchard-cms and unpack to Orchard.Web. When i added and enabled ru-Ru localization all work good for razor views. But for module isn't. For example i try change validate message for required fields in Orchard.DynamicForms, but nothing happened when displayed validation message, they still english. Also translate not applied for module list in admin panel.
Search for the english message in source code, add breakpoint and step into the T() call, then check the value of the scope parameter. This is the value that should be used in the msgctext line.

composite C1 form Renderer localization

I have created a global data type, and use form renderer in a page to let user fill in the data and submit to website.
The default English is working fine.
now when I try to support the second language I run into issues. According to the composite documentation:
1.Add your empty localization file at ~/Frontend/CompositeForms/Renderer/Localization/, for example: Composite.FormsRenderer.de-de.xml
2.Copy the contents of the default Composite.FormsRenderer.en-us.xml to your localization file.
3.Translate the strings.
4.In ~/App_Data/Composite/Composite.config, under the section locate Composite.Plugins.FormsRenderer's add section and register your localization file
but ~/Frontend/CompositeForms/Renderer/Localization does not exist, and neither does Composite.FormsRendereren-us.xml exists.
is the documentation outdated? does anyone had experience with localizing form renderer on user defined data type?
thanks
The documentation IS outdated at the moment (and will be updated soon - thanks for pointing it out).
Do it in the following way on 4.0 or later:
Make a copy of ~/Composite/InstalledPackages/localization/Composite.Forms.Renderer.en-us.xml, changing the language/culture code from 'en-us' to your language's (e.g. Composite.Forms.Renderer.de-de.xml).
Translate the strings.
No need to change anything in ~/App_Data/Composite/Composite.config any more.

How can I find out what Change template a DOORS Module is using?

I need to use DXL to loop through all modules in our database and find out which Rational Change Template each module is using, and possibly switch it to a different one. Can't find any documentation on Change API for DOORS.
I had to contact IBM directly to get this information. But here it is if anyone else needs to do it.
Skip cfgData = createString
string current_template = ""
getModuleConfigurationData(m, cfgData)
find(cfgData, CSINT_CONFIG_USE_TEMPLATE, current_template)
delete cfgData
At this point current_template has the file name of the template that it is configured for. This can be used to compare to existing templates and verify it is set correctly.
Also, if an update is necessary the following function will save the skip list back to the configuration.
put(cfgData, CSINT_CONFIG_USE_TEMPLATE, new_template)
cmSaveModuleConfigurationData(m, cfgData)

How do I create more than 1 translation for a string in poEdit?

I followed this tutorial http://mel.melaxis.com/devblog/2005/08/06/localizing-php-web-sites-using-gettext/ where Hello World is translated into German. If I want to translate Hello World to other language. Do I have to create another message.po and messge.mo file or I can add another translation in the same file or there's another way?
Normally you create one .po file per language, and split them up in different directories based on the locale name (like locale/de_DE/ in the tutorial), then you just use the specific file for the chosen locale as text domain in your implementation.

Setting up localization in Kohana 3.0 framework with set_locale

In a tutorial on setting up internationalization and localization, "Kohana 2.4 I18N (internationalization and localization) Library" the author says:
I'd put it in a Base Controller so that all Controllers inherit it.
This is the code:
I18n::set_locale('tl_PH');
I tried placing it in all the controller and places I could but is not working.
Where is the exact place in Kohana 3.0.4.2 that I should place it?
Put this line in bootstrap.php:
I18n::lang('tl-PH');
The I18n::set_locale function doesn't exist in Kohana 3. See I18n class docs.
Not sure who wrote that article, but locale should be set using the config locale.php config file. You may have to copy it from system/config/locale.php into your application/config/locale.php and set the proper values.
Calling I18n::set_locale() should only happen if you need to change from the default (set in locale.php) to something different (like Dutch, English, etc...).
P.S I'm a Kohana 2.4 core dev...
If you want to set the PHP locale, you will change this is in application/bootstrap.php, there is a setlocale(LC_ALL, 'en_US.utf-8') line there already which you can change to the correct language.
To set Kohana's internal language for translation, add a call to I18n::lang('en-us') (replace "en-us" with your language) after the Kohana::init() call, before Route::set().

Resources