Skip to main content

How to use Code Preview in the wxrks Editor

Code Preview shows the text of the file you're translating, line by line, inside the Editor's preview panel: markup, keys, placeholders and all, with your translations in place. Use it to check where a segment sits in an XML, JSON, YAML, properties or plain-text file without downloading the file. Long lines wrap to the width of the panel, and you can turn wrapping off in your Editor settings.

Who this is for

Code Preview uses the same access as the Editor: if you can open a work unit in the Editor, you can use its preview.

Role

What you use Code Preview for

Vendor

Translate or review a code or text file with each segment's place in the file in view.

Project Manager

Open a work unit from the project's Work units list to check how the translated file reads, or to see what a linguist is looking at when they report a problem.

Line wrapping is a personal setting. Each user turns it on or off for themselves, and a Project Manager can't change it for a linguist.

Which files open in Code Preview

The Editor picks a preview mode from the work unit's file type. Code Preview is the mode for text and structured formats such as XML, JSON, YAML, properties, PO, RESX, XLIFF, Strings and plain text, and for any format that has no more specific preview. For the full list of extensions and the exceptions, see wxrks Preview: Supported File Extensions.

Code Preview is also listed in the Preview Mode menu of every work unit, so you can switch to it when a file opens in another mode. For example, an XML file with an XSLT stylesheet opens in XSLT Preview, and Code Preview shows you the same file as raw XML.

Open Code Preview

  1. Open the work unit in the Editor. For a tour of the Editor's layout, see wxrks Editor.

  2. If the preview panel is hidden, click Show/Hide preview (the eye icon) in the Editor header. The panel opens below the segments.

  3. If the panel shows another mode, click Preview Mode (the ☰ icon at the bottom of the panel's left-hand toolbar) and choose Code Preview.

Editor with an XML work unit whose preview panel shows XSLT Preview. Badge 2 marks the Show/Hide preview eye icon in the Editor header, badge 3 marks the Preview Mode icon at the bottom of the preview's left-hand toolbar, and a red box marks Code Preview in the open Preview Mode menu.

The preview shows the Target side by default: the file rebuilt with the current translations. To see the original file, click the side button (TGT) in the left-hand toolbar to switch it to SRC (Source). Segments without a translation yet show their source text on the Target side.

What the Code Preview toolbar does

The toolbar at the top of the panel shows the file name on the left and these controls on the right:

Code Preview of an XML file with numbered red boxes on the toolbar: 1 the Code mode list set to XML, 2 Highlight segment, 3 Click to select segment, 4 Refresh. The active segment is highlighted in yellow in the preview.

  1. Code mode list: the format used to color the text, picked from the file's extension (for example XML for a .xml file). Change it if the colors don't suit the content, for instance Text Plain for a file that isn't really XML. It changes only the coloring, not the file.

  2. Highlight segment (the highlighter icon): marks the text of the segment you're working on and scrolls the preview to it. It's off by default in Code Preview, and the Editor remembers your choice in this browser.

  3. Click to select segment (the pointer icon): when it's on, clicking text in the preview selects its segment in the segment list. It's on by default. It isn't available when the preview is open in a separate window.

  4. Refresh (the circular arrows): reloads the preview. The Target side reloads by itself shortly after you confirm a segment. Click Refresh to see a translation you've edited but not confirmed yet.

For a Markdown (.md) file, the preview opens formatted, with headings and lists rendered. Click Show source (the eye icon) to see the Markdown text instead, and Show formatted to go back. Highlighting works in the source view only.

JSON files are shown indented, one key per line, even when the original file is on a single line.

Long lines wrap to the panel

A line longer than the preview panel continues on the next row of the panel instead of running off its right edge. You read a long paragraph, string or attribute without scrolling sideways. The line number stays on the first row, so a wrapped line still counts as one line of the file.

Wrapping doesn't change how you work with segments:

  • With Highlight segment on, the preview scrolls to the active segment even when it sits on the wrapped part of a long line.

  • With Click to select segment on, clicking the wrapped part of a line selects the segment in that part.

Code Preview with long XML lines wrapped over several rows under a single line number. A red box marks line 5, whose highlighted segment spans three rows, and another red box marks the Wrap long lines in the preview switch, turned on, in the Editing section of the Settings panel.

Turn line wrapping off or on

Wrapping is on for every user until they turn it off. Turn it off if you prefer to see each line of the file on a single row, for example to compare indentation or the position of attributes.

  1. In the Editor's right-hand panel, click Settings (the gear icon).

  2. Click Editing.

  3. Turn off Wrap long lines in the preview.

The preview changes at once: long lines run past the right edge again and the panel scrolls sideways. To wrap them again, turn the switch back on.

Editor with numbered red boxes: 1 the Settings gear icon in the right-hand panel, 2 the Editing section button, 3 the Wrap long lines in the preview switch, turned off. In Code Preview, each XML line now sits on a single row and the long lines run past the panel's right edge.

ℹ️ Note: The setting is saved to your user account, not to the project or the browser. It applies to every work unit you open, in any browser, and to the preview opened with Open in new window. It only affects Code Preview; the other preview modes follow the layout of the document they show.

Shared Editor preferences can't lock this switch, so linguists can always change it. To learn which settings can be locked, see How to lock linguists' Editor settings with shared Editor preferences.

For Project Managers

  • Open a file's preview from the project. Go to Projects, open the project, and in the Work units list click the file name of a work unit. The Editor opens in a new browser tab, and the preview works the same way as for the linguist.

  • Check the translated file. On the Target side, Code Preview shows the file as it will be rebuilt from the current translations. Use it to check that placeholders, keys and markup around the translated text are intact.

  • Help a linguist who has to scroll sideways. Line wrapping is a personal setting, so you can't turn it on for someone else. Ask the linguist to check Settings > Editing > Wrap long lines in the preview in their own Editor, as described in Turn line wrapping off or on above. Turning the switch on or off in your Editor changes only your view.

  • When a format won't preview. If Code Preview shows Preview is not available for … files yet and no other mode in Preview Mode shows the file, the format has no preview in the Editor. Linguists can still translate it. To inspect the file, use the Download menu in the Editor header.

How Code Preview differs from the other previews

  • Web Preview shows an HTML file, or a live web page, rendered as a browser shows it, with your translations swapped in. Code Preview shows the markup itself.

  • XSLT Preview lays out an XML or XLIFF file as a formatted page, using an XSLT stylesheet attached to the file. Code Preview shows the same file as raw XML.

  • Docs Preview renders Word, PowerPoint, PDF and other documents as paginated pages. Code Preview has no pages: it shows the file's text, one numbered line after another.

For every preview mode and the controls they share, see Dynamic Preview.

Troubleshooting

The preview says "Preview is not available for … files yet". Code Preview can't show this file format. Switch to the mode the Editor picked for the file in the Preview Mode menu.

Some characters show as ? and a warning appears above the preview. The translation uses characters that the file's encoding can't store. The translated file isn't delivered until they're fixed. Click Go to segment in the warning to open the affected segment and replace those characters.

The preview doesn't show my latest translation. The preview reloads by itself only when you confirm a segment. Confirm it, or click Refresh.

Related articles

Did this answer your question?