We have been asked if it is possible to translate some reports to different languages on the fly (from an EN based database).

So my question is, can I translate data stored as ENGLISH into some other language on the fly through the use of a procedure/view/etc?

asked 11 Mar '10, 23:29

Calvin%20Allen's gravatar image

Calvin Allen
1.5k232638
accept rate: 25%

edited 12 Mar '10, 03:26

I'm not sure what you are asking. Are you asking if the data from your database can be translated on the fly? Maybe character sets? Metadata?

(12 Mar '10, 02:25) Ron Hiner

Yeah, that's what I'm asking (I'll edit to make it clearer)

(12 Mar '10, 03:24) Calvin Allen

Anything is possible, its all just software :-)

But it is going to take a bit of work if you want "automatic" translation of english data.

What you will need to do to automatically translate english text into another language is to write an external procedure that takes as input the english text and the language to which you want it translated and it outputs the translated text. Something like:

create procedure translate_text(
                       in  en_text long varchar,
                       in  to_lang varchar(128),
                       out xx_text long varchar )
  external name '...'
  [ language <...> ]

The external procedure can be written in C/C++, any CLR language, Java, Perl, or PHP... so pick your favourite programming language. You will then need to have a method of doing the actual translation - perhaps sign up for one of those online automatic translation services? (and if you do use an online service, perhaps they have a web service that you could use in which case you can just use SQL Anywhere's client web services capability).

You will also need to be conscious of character set used by the external translation service and to make sure that the database text is converted to the proper charset before sending it to the service - this can easily be done using csconvert().

Alternatively, if what you need to do is be able to translate statically known english text into other languages - e.g. pre-known report titles column names, footnotes, etc. - then a much easier solution is to have a table that contains all of your text strings in each of the languages that you need to support. E.g.

create table lang_strings (
       "name"   varchar(20)  not null,  -- an internal name given to each string
       "lang"   char(2)      not null,  -- 'en', 'de', 'jp', etc
       "text"   long varchar not null,  -- text of string in required language
       primary key( "name", "lang" )
);

You will then need to change your app to not use static strings for any english text, but to pull the text from this table.

The table method is what is used in a number of application - e.g. the Check-for-updates system, and the Nexus (aka dbsupport) system.

permanent link

answered 12 Mar '10, 14:52

Mark%20Culp's gravatar image

Mark Culp
23.2k9132273
accept rate: 40%

I wonder... are there any web services that can do this? ...say, from Google? (you know, those guys who win competitions for automatic translation)... you doing anything this weekend, Mark? :)

(13 Mar '10, 09:56) Breck Carter
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×114
×10
×2
×1

question asked: 11 Mar '10, 23:29

question was seen: 753 times

last updated: 12 Mar '10, 14:52