Debian Codegraph @

packages/localize-tools/testdata/build-transform-xliff/goldens/tsout/es-419/foo.js

raw
1 /**
2 * @license
3 * Copyright 2020 Google LLC
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6 import {LitElement, html} from 'lit';
7 const {getLocale} = {getLocale: () => 'es-419'};
8 console.log(`Locale is ${getLocale()}`);
9 window.addEventListener('lit-localize-status', (event) => {
10 console.log(event.detail.status);
11 });
12 const user = 'Friend';
13 const url = 'https://www.example.com/';
14 // Plain string
15 `Hola Mundo!`;
16 // Plain string with expression
17 `Hola ${user}!`;
18 // Lit template
19 html`Hola <b>Mundo</b>!`;
20 // Lit template with one XLIFF placeholder (combined start tag + expression +
21 // end tag).
22 html`Hola <b>${user}</b>!`;
23 // Lit template with two XLIFF placeholders (combined start tag + expression,
24 // separate end tag).
25 html`Clic <a href="${url}">aquí</a>!`;
26 // Lit template with string expression
27 //
28 // TODO(aomarks) The "SALT" text is here because we have a check to make sure
29 // that two messages can't have the same ID unless they have identical template
30 // contents. After https://github.com/lit/lit/issues/1621 is
31 // implemented, add a "meaning" parameter instead.
32 html`[SALT] Clic <a href="https://www.example.com/">aquí</a>!`;
33 // Lit template with nested msg expression
34 html`[SALT] Hola <b>Mundo</b>!`;
35 // Lit template with comment
36 html`Hola <b><!-- comment -->Mundo</b>!`;
37 // Custom ID
38 `Hola Mundo`;
39 // updateWhenLocaleChanges -> undefined
40 export class MyElement1 extends LitElement {
41 constructor() {
42 super();
43 undefined;
44 }
45 render() {
46 return html`<p>Hola <b>Mundo</b>! (${getLocale()})</p>`;
47 }
48 }
49 // @localized -> removed
50 export class MyElement2 extends LitElement {
51 render() {
52 return html`<p>Hola <b>Mundo</b>! (${getLocale()})</p>`;
53 }
54 }
55 // Escaped markup characters should remain escaped
56 html`&lt;Hola<b>&lt;Mundo &amp; Amigos&gt;</b>!&gt;`;
57 // Expressions as attribute values should stay as expressions
58 html`Hello <b foo=${'World'}>World</b>`;
59 html`Hello <b foo=${`Mundo`}>World</b>`;
60 html`<b foo=${`Hola`}>Hello</b><b bar=${`Mundo`}>World</b>`;
61 html`Hello <b .foo=${'World'}>World</b>`;
62 html`Hello <b .foo=${`Mundo`}>World</b>`;
63 // Placeholder in translation has different expression
64 `${user} diferente`;
65 html`<b>${user}</b> diferente`;