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

Pattern Matching

PhilOfWalton
Expert 100+
P: 1,042
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?

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


NeoPa
Expert Mod 15k+
P: 30,549
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

NeoPa
Expert Mod 15k+
P: 30,549
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

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

PhilOfWalton
Expert 100+
P: 1,042
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

Phil
Sep 5 '17 #5

Rabbit
Expert Mod 10K+
P: 12,170
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.