Translation of a js file

I have a client that needs me to translate a js file. It is a web app that help people to select the "right" health plan for their particular circumstances. It asks for past usage, number of people, expected usage this year, etc. and then returns a suggested plan and gives examples of "real" people and how they use the plans. I got partway into the file using some of the suggestions I found here, but the text isn't all displaying in Trados for translation. I assume I need to refine the file type parameters, but I am a bit lost as to where to go from here. Viewing the js file in a text editor, there are html tags embedded in the text, such as <strong>. What should I do to make this work?

Help would be greatly appreciated.

BRAD

emoji
Parents
  • You need to use an embedded content processor to handle the rules.  But you should provide a snippet of the code and its format if you want more helpful advice.  Just a few lines of the full strings.  Should be simple enough to edit the text but keep the format for such a small sample and then we can help.

    emoji
  • I tried using the regex file type and followed instructions I found here about a couple settings to have it find the text. This is what I was looking at:

    https://community.rws.com/product-groups/translationproductivity/f/regex_and_xpath/33607/creating-filetype-and-regex-to-translate-js-file

    I also tried using HTML file type, but I'm lost as to how to get it to limit the search only to the segments we want to translate. I think it has to be a file type that supports HTML. In using the regex file type, it was obviously getting confused at the apostrophes [\'], such as "don\'t". It also wasn't supporting the tags and special characters such as &trade;

    We don't normally do much localization work like this, but I figured it can't hurt to learn while I have the chance (and the time, now that our heavy season is past us).

    BRAD

    ******

    Here are the first few lines of the file:

    dd3
        .constant(
            "dd3Config",
            {
                questions: [
                    {
                        id: '1',
                        category: 'Medical',
                        question: 'What is your coverage level?',
                        why: 'You can buy Single coverage (for yourself only) or you can buy Other levels of coverage to include your eligible dependents, such as your spouse, your same-sex domestic partner (if applicable), your children and/or your spouse\'s/same - sex domestic partner\'s children.',
                        video: false,
                        videoId: '',
                        choices: [{
                            choice: '<strong>Single</strong>. I only buy coverage for myself.',
                            translation: '',
                            weights: [{
                                planId: 1001,
                                weight: 100
                            },
                            {
                                planId: 1002,
                                weight: 0
                            }]
                        }, {
                            choice: '<strong>Other</strong>. I buy coverage for myself and other eligible family members.',
                            translation: '',
                            weights: [{
                                planId: 1001,
                                weight: 0
                            },
                            {
                                planId: 1002,
                                weight: 100
                            }]
                        }]
                    }, {
                        id: '2',
                        category: 'Medical',
                        question: 'How often do you think you or your covered dependents will visit a doctor?',
                        why: 'This can help you estimate how much coverage you\'ll need this year.If you don\'t expect to have a lot of expenses, select "Rarely." Why pay extra for coverage for expenses you probably won\'t have? If you or someone you cover has a medical condition that requires more frequent trips to the doctor for monitoring—such as allergies or high cholesterol—select "Occasionally."If someone you cover is dealing with a serious medical condition or you cover a high number of dependents that take frequent trips to the doctor, select "Frequently."',
                        video: false,
                        videoId: '',
                        choices: [{
                            choice: '<strong>Rarely</strong>. 1 or 2 total visits for a minor illness or injury',
                            translation: '',
                            weights: [{
                                planId: 1001,
                                weight: 100
                            },
                            {
                                planId: 1002,
                                weight: 25
                            }]
                        },
                        {
                            choice: '<strong>Occasionally</strong>. 3 to 7 total visits for minor illnesses or injuries',
                            translation: '',
                            weights: [{
                                planId: 1001,
                                weight: 75
                            },
                            {
                                planId: 1002,
                                weight: 50
                            }]
                        },
                        {
                            choice: '<strong>Frequently</strong>. 8 or more total visits or has a serious health condition',
                            translation: '',
                            weights: [{
                                planId: 1001,
                                weight: 50
                            },
                            {
                                planId: 1002,
                                weight: 75
                            }]
                        },
                        {
                            choice: 'I will only go for my preventive visits',
                            translation: '',
                            weights: [{
                                planId: 1001,
                                weight: 0

    emoji
  • Your file is a little different to the example in that thread.  So you need to address the format of the file.  There are a number of ways you could handle it, but it might be easiest to just create separate rules for the structure, like this:

    Trados Studio options window showing Document structure settings with opening and closing patterns for category, question, and choice.

    You could do it in one rules using this, but sometimes just keeping it simple is easier!

    Close-up of Trados Studio Document structure settings with opening and closing patterns for category, question, and choice.

    Then add whatever inline rules you need.  I added these two... one tag pair for the html in your example and one placeable for the entity:

    Trados Studio options window showing Inline tags settings with opening and closing patterns for strong HTML tag and entity placeholder.

    Now I have this which looks reasonable:

    Preview of test.js file in Trados Studio with highlighted strong HTML tags and entity placeholders in the text.

    I put my test settings file here in case it helps:

    brad_js.zip

    I think this should be enough to help you tweak it for your needs.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 4:40 AM (GMT 0) on 5 Mar 2024]
Reply
  • Your file is a little different to the example in that thread.  So you need to address the format of the file.  There are a number of ways you could handle it, but it might be easiest to just create separate rules for the structure, like this:

    Trados Studio options window showing Document structure settings with opening and closing patterns for category, question, and choice.

    You could do it in one rules using this, but sometimes just keeping it simple is easier!

    Close-up of Trados Studio Document structure settings with opening and closing patterns for category, question, and choice.

    Then add whatever inline rules you need.  I added these two... one tag pair for the html in your example and one placeable for the entity:

    Trados Studio options window showing Inline tags settings with opening and closing patterns for strong HTML tag and entity placeholder.

    Now I have this which looks reasonable:

    Preview of test.js file in Trados Studio with highlighted strong HTML tags and entity placeholders in the text.

    I put my test settings file here in case it helps:

    brad_js.zip

    I think this should be enough to help you tweak it for your needs.

    emoji


    Generated Image Alt-Text
    [edited by: Trados AI at 4:40 AM (GMT 0) on 5 Mar 2024]
Children
No Data