I am use this example to internationalize my website.
The admin can create new topics in English, and I want to show the same topic in Spanish.
How can this be done?
it isn't standars works like Register or other to do that
Html.ActionLink(Resources.Register, "Register")
The admin can create topics - this means that content is dynamic, therefore you can't use resources files any longer. You should structure your database to support localization. Then you would have to read language locale from thread that's currently being executed.
Additionally, you may let user to select his language. In this scenario you will store selected language in a session and retrieve localized data from the database based on language locale in the session.
Finally you can write code to read first default language in a web browser. For example, change your language to hungarian in a web browser and go to google, see what happens.
You should use Localization and Globalization, take a look at http://msdn.microsoft.com/en-us/library/c6zyy3s9.aspx
Related
I have an application in ASP.Net in AngularJS, until then that my application had the need only in Brazil, but recently the company where I work needs to make this site available to other countries in other languages like Spanish and English.
I have never worked with International applications, so there will be many doubts and difficulties.
I'll start with the difficulties:
- My application has fixed texts in the html, database and code, how can I translate all these fronts? Is there a component that translates everything into the client? (Javascript, AngularJS, etc ...).
- Development time for this change (Too much code to change).
Questions: - Decimal, Date and Time, how to work with these values in an International application? (My application has many logs and values to display and insert)
I'm researching a lot but really needed a hint of where I could go.
Thank you, I'll wait!
I would start searching for "Localization". There is something called "AspNetBoilerplate" that has implemented localization into there project. Here is their link: https://aspnetboilerplate.com/ and here is document on how to use it within their project: https://aspnetboilerplate.com/Pages/Documents/Localization. You can easily download a free project and see what they did to implement it.
They have different localization files based on language being used. The language being used is a setting in the DB based upon the tenant that logs in. All static text looks up to its respective localization file (See their .Core project under "Localization" to see all their files).
As far as DateTimes/Decimals/etc, I would have extension methods that looked up the cached localization being used and format respectively.
By no means am I recommending you use this software but rather see how they implemented it within their project. Also, know that I have only had to do this once and there may be numerous other ways to accomplish this goal.
I would like to purchase the product Paymill Gateway for one of our customers. His website comes with 3 different languages: German, English and French
As far as I know Paymill supports these 3 languages but how exactly would that work? Can I only CHOOSE between one of those languages or would the details of the page automatically get translated whenever the user switches the language of the website?
I hope somebody has experience with this plugin and can update me with some details.
you should consider trying out the free but official alternative on https://wordpress.org/plugins/paymill/
In the official plugin there are several language packs included which are loaded depending on your language settings in WordPress. The plugin WordPress MultiLanguage can help to serve different languages and switching between them.
Please also note that support requests may be faster handled on official support forum https://wordpress.org/support/plugin/paymill
If you are using the paymill.createToken function, validation happens in JavaScript. The function passes an error object in its callback; the error code can be accessed through error.apierror.
You can build a language map to display the error message in different languages. For example:
var messages={
'en':{
'field_invalid_card_number':'Invalid Card Number',
'field_invalid_card_exp': The card has expired'
},
'de':{
'field_invalid_card_number':'Ungueltige Kartenummer',
'field_invalid_card_exp':'Die Karte ist abgelaufen'
}
}
Then with some additional logic you may display the suitable target language.
Currently i have not a code-problem, but i dont know which way would be better for me.
For our project, we have two kind of data which would be translatet for the view.
The part, which be coded in the source code like system messages (e.g. You are logged in, log out, etc.)
The second part is the database content like services, there can be added or deleted rows. And not for every entity would be a translation available.
Now i need to know, if i should save and get the translation from a translation table or is it better to transfer (via script) the translation into a services.xliff file
I would suggest to use XLIFF or GetText for the application (source: php, js).
Especially http://jmsyst.com/bundles/JMSTranslationBundle might be helpful.
The storage mechanism is less important, because of caching. So feel free to use either a DB or files as backend.
User created content is often managed via database. So you might use a common DoctrineExtension, like translateable. http://symfony.com/doc/current/cookbook/doctrine/common_extensions.html
https://github.com/stof/StofDoctrineExtensionsBundle/blob/master/Resources/doc/index.rst
I'm conducting a project in which a website should have multi-language support.
Now, this website is supposed to serve about 500K+ visitors a day, so it must be super-efficient.
I've created a table of parameters {[ID],[Name]} AND a linkage-table {[objectID],[parameterID],[languageID],[value]}. I think it's the best way to deploy multi-language support while having the privilege to translate different parameters for each language.
As far as I know, server's memory is much faster than a physical HDD. Therefore, I'm planning to store ASP.NET Application State objects for my translation architecture.
(http://msdn.microsoft.com/en-us/library/ms178594.aspx)
How does my plan sound so far? any suggestions?
If you are planning on making an app that support multiple languages, your instant reflex should be let .net do the work for you. What i'm reading in your question is that you are setting up something to support that. You should know that localization is the way to go when you want to develop a multi-language environment.
Take a look at this msdn article, it should give you a general idea on the topic.
So, localizing an application can be divided into two parts:
Localizing business logic entities.
Localizing everything else.
In the question I see words which are related to business entity localization. For that purpose I agree with the concept to have separation between entities and their localizations.
Part 1 - Localizing entities:
Personally I do this way in database:
table Entity {EntityID, Name} -this is the entity-related table.
table EntityByLang {EntityID, LanguageID, Name} -this is the localized version of the table for each supported language.
This way allows me to have default values for each localizable property like Name and its localization, if such is available in the localized table. What's left here up to you is - you need to implement the data-access-layer which takes the Name localized for the current user language, or the default value (if language or the translation is not available for the given language).
Part 2 - Localizing everything else:
Here, with no alternatives in terms of the performance, I would recommend using some kind of static resources. Personally I live with static resources available for standard asp.net applications.
From the architectural point of view, don't directly refer to localization code from your UI code, like this (which I don't like):
var translation = HttpContext.Current.GetGlobalResourceObject("hello");
//excuse me, if I don't exactly remember the GetGlobalResourceObject() method name...
Instead, I would recommend using this kind of approach:
var translation = AppContext.GetLocalizationService().Translate("hello");
Where: AppContext - some kind of facade/factory (in fact, implementation of abstract facade/factory). GetLocalizationService - initially returns some kind of ILocalizationService, when implemented it returns StaticResLocalizationService (which implements ILocalizationService). This way allowing switching from one kind of localization to another. And particularly StaticResLocalizationService works with asp.net static resources
Sorry for messy sample codes, but I hope you understand my approach.
I hope this helps!
I would suggest to create custom resource provider, you can read more here:
http://msdn.microsoft.com/en-us/library/aa905797.aspx
with this model you can leverage existing asp .net localization functionality
As the question is a bit self explanatory, I want to achieve the goal of a multi-language website. I am using an Entity Data Model with MS SQL 2005. I came up with an idea of making a seperate database for each language with exactly the same model and relations. So I can use the Entities constructor that takes a connectionString and switch the site to the selected language.
I am using an ascx as the language control that fires an event, and the parent aspx gets the selected language as an integer (from event args) and call the method containing the same linq queries but Entity context will be created with the connection string of that db (of language)
I could only came up with this solution, because I think adding a new language will require a replication of the english one, imported to Access and sent to the translator. Then will be exported back, and the model will fit (HOPEFULLY).
My question is if this is really a good approach or am I missing anything that will create greater hassle to me. Thanks in advance
multi-database is not a good solution as soon as entities within the different databases have relations to each other. Generally a good approach is to work with labels in one default language. These labels can either be in a well defined format (e.g. 'LABEL.TEXT_HELLO') or just in the base language (e.g. 'Hello World').
So all you have to do is building a table for translations where the base language is the key and hopefully there is for each key a value containing the translation. As soon as you have the translations, you can write a method ont he frontend which writes the labels in the language used by the user.
In Zend Framework for example, you have to write <h1><?= $this->translate('Hello World'); ?></h1> instead of just <h1>Hello World</h1>
The good thing about that is, that if ya translation is missing, you can still use the fallback (in this case english) to show the user at least something.
That way, you can manage your app in one database and users who speak several languages do not have to switch between applications and content.
cheers
My approach: create a table Language that lists all the available languages. Relate each table that should be localized to Language. Now, you can easily access the localized content e.g.
Content[content_ID].HeadLine.Where(hl => hl.Language.id == "en-US")
I look forward to see what other people as I myself is still learning DB design and EDM.
OK, if you want to be able to easily implement a new language, then reinventing the internationalization features already built in to ASP.NET is not the way to go, because it isn't "easy".
At least, not as easy as using a satellite resource DLL. Your translators will use off-the-shelf tooling to translate your resources, and ASP.NET will automatically select the correct DLL based on the user's current culture.
Read up on ASP.NET internationalization/globalization features; there's no need to invent your own.