I am developing one application where the client wants to see contents in both arabic and english. The displayed data is retrieving from database SQL.
The question here is If the user saves his details in database in english language, how can i show that data in arabic from database?
How can i achieve this part?
You have to use a translator API and save both the languages to database.
I don't know how you can do that without using some sort of translation service, there is nothing in .NET or SQL server (or any other RDBMS that I know of) that will do that for you.
Here's one (API) that is from Microsoft if you need a place to start: https://www.microsoft.com/en-us/translator/translatorapi.aspx
Depending on your requirements, you may want to translate data immediately and store it into the opposite database; however it may end up being expensive, so if you're able you might choose to translate things on demand to save some costs.
i think An effective way to create localized Web pages is to use resource objects for your page's text and controls. By using properties placed in resource objects, ASP.NET can select the correct property at run time according to the user's language and culture. The process is straightforward:
Resource Files and ASP.NET MVC Projects
fore more info
Related
I have a requirement where I have a site and the user enters the product information from an administrative end.
One of the mandatory requests is to select a country for the product before the user can save the product.
When a public user arrives at the site they need to have the option to swap between the languages. So if I arrived to the German site and want to view the site in English I should be able to change from German to English (and back to German).
I have the resource files created (German) however how do I swap between the two languages. I appreciate I may need to tweak a little more but if I can get onto the right track I can take it/question from there?
First you ensure you save the data in the correct encoding in your database by configuring the data collation for each language, and save it in the correct datatype.
To do that you must do the following :
Database
Ensure the column or database collation is defined to the targeted language read more about it SQL Server, Oracle, MySQL
Ensure the column datatype is designed to accept Unicode characters. (if you save some text, it should show it as is).
Application
in your ASP.NET Application, you ensure that you read these data from the database with the correct encoding ( UTF-8 is a common encoding for the web, but sometimes you might need to use ASCII or Unicode then convert it back to UTF-8 depends on the language you're dealing with).
After ensuring the string encoding. You can now use it on your ASP pages, you only need to control the page language you have two options.
Option 1 : Use Javascript to translate the page to another language dynamically using html lang attribute.
Option 2 : Use .NET Globalization by defining the translations using resources files more in that in this link
As a DBA/SQL Server Developer, I'm often asked to produce web pages where users can view the data in the database and edit them, and see the edits they've made straight away (without refreshing the page). I know nothing about ADO.NET or C#, but I would like to be able to give users this very simple functionality. Essentially I'm looking for three things:
to display a table of data in a webpage retrieved from a SQL Server stored procedure
to display a text box in the same webpage where users can input data
to display a button in the webpage that takes the inputted data from the text box, runs it through the stored procedure as a parameter, and refreshes the table.
Ideally I'd like this all to happen without the user having to refresh the webpage.
My questions are: is this kind of thing possible? How difficult is it to achieve? And how do I do it? I don't have the time to learn web development in full. I wouldn't need the vast majority of skills I'd learn even if I did learn it in full. I just really need this basic functionality, to produce ultra simple pages when user requests come in.
If anyone knows of any examples of just this kind of thing, that I can copy, they would be greatly appreciated!
You don't really need to use MVC, WebForms or even C# for that matter. Using one of those would be killing a ant with a rocket launcher.
Look into node.js and pug, using a RESTFUL API to deliver the information you need. I don't believe you will need more than two hours to provide your users with the interface you told us.
Node has a awesome package called express, it sets up everything for you and uses Pug on the starter template.
You can check out a tutorial right here.
Actually it will also take 2 hours doing with Webforms or MVC . I recommend using Entity Framework to make it super simple.
Webforms may be a bit older technology but will be faster to develop this specific page (assuming you only targeting Desktop users). Otherwise MVC is the way to go.
You can Check the tutorial.
https://learn.microsoft.com/en-us/aspnet/mvc/overview/getting-started/introduction/getting-started
I am working on a contract management system on c# form application, one of the main parts of the project is to create a letter.
In this part of the application a user can send a letter with in the shape he or she wants, so I need an editor like FCK in html, because my users should be able to insert table insert image and etc.
Any idea how to get this working? Any concerns?
You could indeed use a HTML WYSIWYG editor, but depending on the quality of it, it might raise problems when converting the output of it to print. This may also depend on the framework used to generate the Word document.
In one of our environments, we use CKEditor and JasperReports. That combination is suitable to export to Word, since JasperReports supports reading HTML and convert that to Word.
However, the best solution may depend on your business requirements and personal preferences.
If the application is a business application, another option is to let them edit the document in Word. Our company (disclaimer: I am biased) has build a product that supports editing a Word document from a template loaded and filled from a database (or multiple databases). However, if it is useful to you depends on your business requirements.
FCK is history now and as mentioned by others CKEditor is the successor. TinyMCE would be another alternative, or any other might be..
But what I want to mention is along with possible printing issues (that I have never dealt with) I want to underline another aspect:
my users should be able to insert table insert image and etc.
uploading and inserting images might be another issue...they don't come with a built in uploader, they sell it. you have the option to buy CKFinder along with CKEditor and Moxiemanager along with TinyMCE unless you choose to handle upload and insert into the editor process yourself.
I am writing a desktop application using MVVM and Prism and I have the following problem. As well as the labels etc it is also necessary to store data in different languages.
For example, in the USA a user might be able to login using either English or Spanish (as they are a native speaker).
If the user logs in using Spanish when they go into a product details
form the product description will be saved to the database against
the Spanish language.
If they log in using English the product description will be saved to
the database and related to the English language.
At the moment my only ideas is as below:-
- a globally accessible ApplicationViewModel that contains a
CurrentLoggedInUser property
What I would like to know is how I go about saving the currently logged in user's chosen language when using MVVM, particularly in a desktop application?
N.B the chosen language can be different to the language and locale that the operating system is in
How do other people go about resolving this and maintaining the user's "session" across different windows / user controls when using MVVM?
All you need to do is store the current language somewhere, maybe as an LCID.
Generally this is used to load a language specific resource file, which takes care of most language dependant situations. Controls etc just store all their strings in resources, so they don't need direct access to the current language.
For situations where you do need access to the language, such as knowing where to save your database string, then yes, the language should be exposed either as some static/singleton, or more desirably, should be injected into whatever ViewModels need it.
I would like to request opinions in order to approach internationalization of a website in C#.
I´m working with resx files to define strings of text. I would like to know if its possible to use resx to define categories - eg: commerce website - or its preferred to use a table in the database with a foreign key to table category?.
brgds.
As a general rule, use resx files to localize strings that can only be added by developers and are only updated when new versions of the application are deployed. Resx files are specially tailored for this purpose and work great.
If you want to give the end user the ability to add their own values you will have to do the localization in the database (or use some other mechanism).
I thing that for a website it would be nicer to use a table in your database. Otherwise if you should write a desktop application. I would prefer a resx file.
So that you can load that file on the start of your program. So you don't need to go to a database. For a website you already need a connection to get some other data to fill the page.