422,757 Members | 1,365 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,757 IT Pros & Developers. It's quick & easy.

Pattern Matching

Expert 100+
P: 1,116
I am using Google Translate to translate Combo Box Value Lists from say German to English

This is the input string:-
1;"Englisch";"en";2;"Französisch";"fr";3;"Deutch"; "de";4;"Spanisch";"es";5;"Russisch";"ru";6;"Mongol isch";"mn"

This is the output string:-
1, "english", "s", 2, "french", "fr", 3, "deutch"; "de", 4, "spanish", "it", 5, "russian", "ru"; 6; "mongolian"; "mn"

As you may notice, some of the semicolons in the input string have been transformed into commas.

Now obviously a replace function would work in this case, but if there was a comma within the quoted word that would be incorrectly changed.

Any ideas please?

Sep 3 '17 #1
Share this Question
Share on Google+
5 Replies

Expert Mod 15k+
P: 30,741
Not sure what the task is here Phil. I can't see why some are left as semi-colons while others are converted to commas.

That aside though, have you considered using Regular Expressions? I believe there was a thread about that a while back but rather unfortunately (stupidly) I didn't make a note of it at the time in my database.
Sep 3 '17 #2

Expert Mod 15k+
P: 30,741
I can't find an earlier discussion I was involved in but here's a link that may help - Regular Expressions in VBA.
Sep 3 '17 #3

Expert Mod 15k+
P: 30,741
Of course, no sooner did I post that last one than I found it - RegEx Discussion.
Sep 3 '17 #4

Expert 100+
P: 1,116
Thanks, NeoPa, sorry for the delay in replying. Have really been struggling with this Db.

To cut a long story short, in a moment of madness, I offered to help a chap who wanted a multi-lingual database. Then I thought further and decided to develop it as as some form of Access add-on to convert any Db to a different language. I'm pretty well on with it an that I can translate most of the fixed information on forms and reports into different languages, as well as combo boxes using semi- fixed information (Language being an obvious one)

I build a table of things like label captions, command captions, Page captions, form captions, control tip text, status bar and as mentioned, Combo box drop downs.

The original database was written in German.

I use Google Translate to automatically translate the above into the required language, and op opening the forms & reports, apply the translated words.

The original question shows a Value List from a German Combo Box, and Google's attempt at translating it.

I wasn't aware of Regex and will have look at that a bit later on. For the moment I can correct manually, but I need to press on ironing out bugs.

Thanks again

Sep 5 '17 #5

Expert Mod 10K+
P: 12,204
The long term solution would be to use regex to strip out a listing of all words without punctuation or minimal punctuation, translate that, and use regex to insert it back into the original format.

A short term workaround for this particular issue could be to split the string on the semi-colon, loop each option through the translation, and rebuild the string. Or do a search and replace on """, """.
Sep 5 '17 #6

Post your reply

Sign in to post your reply or Sign up for a free account.