<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>Lingui Blog</title>
        <link>https://lingui.dev/blog</link>
        <description>Lingui Blog</description>
        <lastBuildDate>Tue, 12 Dec 2023 00:00:00 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <item>
            <title><![CDATA[Lingui hits 4k Stars on GitHub ⭐]]></title>
            <link>https://lingui.dev/blog/2023/12/12/4k-stars</link>
            <guid>https://lingui.dev/blog/2023/12/12/4k-stars</guid>
            <pubDate>Tue, 12 Dec 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[social-card image]]></description>
            <content:encoded><![CDATA[<p><img decoding="async" loading="lazy" alt="social-card image" src="https://lingui.dev/assets/images/social-card-a03d60363f410cb55758d54e23fd34b8.png" width="1200" height="630" class="img_ev3q"></p>
<p>We're thrilled to announce that the <a href="https://github.com/lingui/js-lingui" target="_blank" rel="noopener noreferrer">Lingui repository</a> has reached an important milestone - <strong>4,000</strong>&nbsp;stars! This achievement is a testament to the growing popularity of Lingui as a powerful and flexible internationalization solution for global products.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="advantages">Lingui has been gaining traction in the JS community due to its several key advantages<a href="https://lingui.dev/blog/2023/12/12/4k-stars#advantages" class="hash-link" aria-label="Direct link to Lingui has been gaining traction in the JS community due to its several key advantages" title="Direct link to Lingui has been gaining traction in the JS community due to its several key advantages">​</a></h3>
<ul>
<li>
<p><strong>Universal</strong> - use it everywhere: Vanilla JS, React, Vue.js, Next.js, Node.js, etc.</p>
</li>
<li>
<p><strong>Full rich-text support</strong> - use React components within localized messages without restriction. Writing rich-text messages is as easy as writing JSX.</p>
</li>
<li>
<p><strong>Powerful tooling</strong> - manage the entire intl workflow with the <a href="https://lingui.dev/ref/cli" target="_blank" rel="noopener noreferrer">Lingui CLI</a>. It extracts messages from source code, validates messages coming from translators, and many more. Use the <a href="https://lingui.dev/ref/eslint-plugin" target="_blank" rel="noopener noreferrer">ESLint plugin</a> to find common Lingui usage errors in your code. In addition, for Vite users, we have the <a href="https://lingui.dev/ref/vite-plugin" target="_blank" rel="noopener noreferrer">Vite plugin</a> which compiles Lingui catalogs on the fly and provides additional configuration needed for Vite.</p>
</li>
<li>
<p><strong>Customization</strong> - integrate Lingui with your existing workflow. It supports both message keys and auto-generated messages. Translations can be stored in a <a href="https://lingui.dev/ref/catalog-formats" target="_blank" rel="noopener noreferrer">variety of file formats</a> including PO, JSON, and CSV. For more advanced usage, there is a possibility to create a <a href="https://lingui.dev/guides/custom-extractor" target="_blank" rel="noopener noreferrer">Custom Extractor</a> or <a href="https://lingui.dev/guides/custom-formatter" target="_blank" rel="noopener noreferrer">Custom Formatter</a> for your project.</p>
</li>
</ul>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="use-cases">Here are some of the ways that Lingui is being used by companies around the world<a href="https://lingui.dev/blog/2023/12/12/4k-stars#use-cases" class="hash-link" aria-label="Direct link to Here are some of the ways that Lingui is being used by companies around the world" title="Direct link to Here are some of the ways that Lingui is being used by companies around the world">​</a></h3>
<ul>
<li><a href="https://github.com/ansible/awx" target="_blank" rel="noopener noreferrer">Ansible</a> - an open source community project sponsored by Red Hat, it's the simplest way to automate IT.</li>
<li><a href="https://github.com/MetaMask/snaps-directory" target="_blank" rel="noopener noreferrer">Metamask</a> - a crypto wallet &amp; gateway to blockchain apps.</li>
<li><a href="https://github.com/Uniswap/interface" target="_blank" rel="noopener noreferrer">Uniswap</a> - an open source interfaces for the Uniswap protocol.</li>
</ul>
<p>These are just a few examples of the many companies that use Lingui to power their internationalization efforts. We're confident that Lingui will continue to grow in popularity as more and more companies recognize its value.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="thanks">Thanks to the community<a href="https://lingui.dev/blog/2023/12/12/4k-stars#thanks" class="hash-link" aria-label="Direct link to Thanks to the community" title="Direct link to Thanks to the community">​</a></h3>
<p>This milestone wouldn't have happened without all of you, so we want to thank the awesome community for being with Lingui all the way along. Join the <a href="https://lingui.dev/misc/community" target="_blank" rel="noopener noreferrer">Lingui community</a> and help us make Lingui even better!</p>]]></content:encoded>
            <category>news</category>
            <category>community</category>
        </item>
        <item>
            <title><![CDATA[Announcing Lingui 4.0]]></title>
            <link>https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0</link>
            <guid>https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0</guid>
            <pubDate>Wed, 26 Apr 2023 00:00:00 GMT</pubDate>
            <description><![CDATA[Today we are happy to finally announce Lingui 4.0! 🥳️]]></description>
            <content:encoded><![CDATA[<p>Today we are happy to finally announce Lingui 4.0! 🥳️</p>
<hr>
<p><img decoding="async" loading="lazy" alt="social-card image" src="https://lingui.dev/assets/images/social-card-4f677a99672310a84d577074820b1d0c.png" width="1200" height="630" class="img_ev3q"></p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="what-is-lingui-exactly">What is Lingui exactly?<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#what-is-lingui-exactly" class="hash-link" aria-label="Direct link to What is Lingui exactly?" title="Direct link to What is Lingui exactly?">​</a></h2>
<p>Lingui is a powerful and flexible <strong>internationalization</strong> (i18n) and <strong>localization</strong> (l10n) library for JavaScript projects, including React, Vue.js, Node.js, Next.js, Angular, and more. It provides a set of tools and APIs that make it easy for developers to create multilingual applications.</p>
<p>One of the key benefits of Lingui is that it simplifies the process of managing translations by providing a centralized way to store and manage translation files.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="key-features">Key features<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#key-features" class="hash-link" aria-label="Direct link to Key features" title="Direct link to Key features">​</a></h3>
<ul>
<li><strong>Clean and readable</strong> - keep your code clean and readable, while the library uses the battle-tested and powerful ICU MessageFormat under the hood.</li>
<li><strong>Universal</strong> - use it everywhere: Vanilla JS, React, Vue.js, Next.js, Node.js, etc.</li>
<li><strong>Full rich-text support</strong> - use React components within localized messages without restriction. Writing rich-text messages is as easy as writing JSX.</li>
<li><strong>Powerful tooling</strong> - manage the entire intl workflow with <a href="https://lingui.dev/tutorials/cli" target="_blank" rel="noopener noreferrer">Lingui CLI</a>. It extracts messages from source code, validates messages coming from translators, and verifies that all messages are translated before shipping to production.</li>
<li><strong>Unopinionated</strong> - integrate Lingui with your existing workflow. It supports both message keys and auto-generated messages. Translations can be stored in a <a href="https://lingui.dev/ref/catalog-formats" target="_blank" rel="noopener noreferrer">variety of file formats</a> including PO, JSON, and CSV.</li>
<li><strong>Lightweight and optimized</strong> - core library is only <a href="https://bundlephobia.com/result?p=@lingui/core" target="_blank" rel="noopener noreferrer">1.5 kB gzipped</a>, React components are additional <a href="https://bundlephobia.com/result?p=@lingui/react" target="_blank" rel="noopener noreferrer">1.3 kB gzipped</a>.</li>
<li><a href="https://lingui.dev/misc/community" target="_blank" rel="noopener noreferrer">Active community</a>.</li>
</ul>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="whats-new-in-40">What's new in 4.0?<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#whats-new-in-40" class="hash-link" aria-label="Direct link to What's new in 4.0?" title="Direct link to What's new in 4.0?">​</a></h2>
<p>This version is packed with tons of new features, improvements and fixes that will make internationalizing your JavaScript projects much easier!</p>
<p>The codebase has also been significantly refactored and updated. As a result, Lingui has become much more stable, lightweight, reliable, and less fragile.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="extractors">Extractors<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#extractors" class="hash-link" aria-label="Direct link to Extractors" title="Direct link to Extractors">​</a></h3>
<p>The big change in v4.0 is in the extractor internals. It is now less fragile and doesn't depend on host project settings. Also, the extractor now supports TypeScript out of the box.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="hash-based-message-ids--context">Hash-based message IDs + Context<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#hash-based-message-ids--context" class="hash-link" aria-label="Direct link to Hash-based message IDs + Context" title="Direct link to Hash-based message IDs + Context">​</a></h4>
<p>The previous implementation had a flaw: there is an original message in the bundle at least 2 times + 1 translation.</p>
<p>For the line "Hello world", it will exist in the source as an ID in the i18n call, then as a key in the message catalog, and then as the translation itself. Strings can be very long, not just a few words, so this may add more kB to the bundle.</p>
<p>A much better option is to generate a "stable" ID based on the <code>msg</code> + <code>context</code> as a fixed length hash.</p>
<p>We've also added the ability to specify a <strong>context</strong> for the message. For more details, see the <a href="https://lingui.dev/tutorials/react-patterns#providing-a-context-for-a-message" target="_blank" rel="noopener noreferrer">Providing a context for a message</a>.</p>
<p>The context feature affects the message ID generation and adds the <code>msgctxt</code> parameter in case of the PO catalog format extraction.</p>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="custom-extractors">Custom Extractors<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#custom-extractors" class="hash-link" aria-label="Direct link to Custom Extractors" title="Direct link to Custom Extractors">​</a></h4>
<p>The extractor refactoring has allowed the creation of <strong>Custom Extractors</strong>. If your project does not work well with Lingui's extractor, you can easily write your own extractor implementation. This might be the case if you are using some experimental features (stage0 - stage2) or frameworks with custom syntax like Vue.js or Svelte. See the <a href="https://lingui.dev/guides/custom-extractor" target="_blank" rel="noopener noreferrer">Custom Extractor</a> guide for more details.</p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_BuS1"><p>Thanks to this feature, we have implemented a <a href="https://lingui.dev/tutorials/extractor-vue" target="_blank" rel="noopener noreferrer">Vue.js Extractor</a> that is already successfully integrated into Vue.js projects!</p></div></div>
<h4 class="anchor anchorWithStickyNavbar_LWe7" id="flow-syntax-support">Flow Syntax support<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#flow-syntax-support" class="hash-link" aria-label="Direct link to Flow Syntax support" title="Direct link to Flow Syntax support">​</a></h4>
<p>Lingui supports <a href="https://flow.org/" target="_blank" rel="noopener noreferrer">Flow</a> by default. If your project uses Flow, you need to explicitly <a href="https://lingui.dev/guides/flow" target="_blank" rel="noopener noreferrer">enable support</a> in the extractor.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="custom-formatters">Custom Formatters<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#custom-formatters" class="hash-link" aria-label="Direct link to Custom Formatters" title="Direct link to Custom Formatters">​</a></h3>
<p>If your project requires a special format or handling logic, you can write your own format implementation.</p>
<p>Formatter is a simple object with 2 main functions <code>parse</code> and <code>serialize</code>, which should take Lingui catalog and serialize it to string and vice versa.</p>
<p>You don't need to create a separate package for formatter, you can write it directly in <code>lingui.config.{ts,js}</code>.</p>
<p>The built-in Lingui formatters have been extracted into a separate packages:</p>
<ul>
<li><a href="https://www.npmjs.com/package/@lingui/format-po" target="_blank" rel="noopener noreferrer">@lingui/format-po</a> (enabled by default)</li>
<li><a href="https://www.npmjs.com/package/@lingui/format-po-gettext" target="_blank" rel="noopener noreferrer">@lingui/format-po-gettext</a></li>
<li><a href="https://www.npmjs.com/package/@lingui/format-json" target="_blank" rel="noopener noreferrer">@lingui/format-json</a></li>
<li><a href="https://www.npmjs.com/package/@lingui/format-csv" target="_blank" rel="noopener noreferrer">@lingui/format-csv</a></li>
</ul>
<p>See the <a href="https://lingui.dev/guides/custom-formatter" target="_blank" rel="noopener noreferrer">Custom Formatter</a> guide for more details.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="experimental-dependency-tree-crawling">Experimental dependency tree crawling<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#experimental-dependency-tree-crawling" class="hash-link" aria-label="Direct link to Experimental dependency tree crawling" title="Direct link to Experimental dependency tree crawling">​</a></h3>
<p>While the standard glob-based extraction process is effective for most projects, multipage (MPA) frameworks such as NextJS pose a problem because the glob-based approach creates a catalog consisting of all messages from all pages.</p>
<p>This means that the entire catalog must be loaded for each page/navigation, which results in loading messages that are not used on that page.</p>
<p>To address this issue, a new experimental extractor was introduced in version 4. This extractor uses the dependency tree of files, rather than just a glob pattern, to crawl imports and discover files more accurately.</p>
<p>By doing so, it creates a more optimized catalog that only contains the messages needed for each page.</p>
<p>The catalogs would still contain duplicate messages for common components, but it would be much better than the current approach.</p>
<p><img decoding="async" loading="lazy" alt="Scheme of discovering by dependencies" src="https://lingui.dev/assets/images/extractor-deps-scheme-481ed2b1a17151e7ba26ee8831d4ad10.jpg#gh-light-mode-only" width="2388" height="1674" class="img_ev3q">
<img decoding="async" loading="lazy" alt="Scheme of discovering by dependencies" src="https://lingui.dev/assets/images/extractor-deps-scheme-dark-f3b292d7624be7098afde4dd5110e01e.jpg#gh-dark-mode-only" width="2286" height="1749" class="img_ev3q"></p>
<div class="theme-admonition theme-admonition-tip admonition_xJq3 alert alert--success"><div class="admonitionHeading_Gvgb"><span class="admonitionIcon_Rf37"><svg viewBox="0 0 12 16"><path fill-rule="evenodd" d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"></path></svg></span>tip</div><div class="admonitionContent_BuS1"><p>See the <a href="https://lingui.dev/guides/message-extraction" target="_blank" rel="noopener noreferrer">Message Extraction</a> guide to learn more about how message extraction works.</p></div></div>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="improved-react-support">Improved React support<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#improved-react-support" class="hash-link" aria-label="Direct link to Improved React support" title="Direct link to Improved React support">​</a></h3>
<p>Lingui v4.0 includes a bunch of improvements to its React support, making it even easier for developers to implement internationalization and localization in their React applications. Visit the <a href="https://lingui.dev/tutorials/react" target="_blank" rel="noopener noreferrer">Internationalization of React apps</a> and <a href="https://lingui.dev/tutorials/react-patterns" target="_blank" rel="noopener noreferrer">Common i18n patterns in React</a> tutorials to learn the most common patterns for internationalizing React applications.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="plugins">Plugins<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#plugins" class="hash-link" aria-label="Direct link to Plugins" title="Direct link to Plugins">​</a></h3>
<p>During the development of Lingui v4.0, we have created two new plugins to improve the integration of Lingui with other tools and frameworks. These plugins are the <a href="https://lingui.dev/ref/swc-plugin" target="_blank" rel="noopener noreferrer">SWC Plugin</a> and the <a href="https://lingui.dev/ref/vite-plugin" target="_blank" rel="noopener noreferrer">Vite Plugin</a>.</p>
<p>Both of these plugins are designed to make it easier for developers to use Lingui with other modern tools and frameworks. We are excited to see how developers will use these plugins to improve their localization workflows and make their applications more accessible to a global audience.</p>
<h3 class="anchor anchorWithStickyNavbar_LWe7" id="more-examples">More examples<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#more-examples" class="hash-link" aria-label="Direct link to More examples" title="Direct link to More examples">​</a></h3>
<p>As part of Lingui v4.0, we've also created new example projects that show how Lingui can be integrated into different types of applications. These projects demonstrate best practices for integrating Lingui with popular frameworks and libraries, including <a href="https://github.com/lingui/js-lingui/tree/main/examples/nextjs-babel" target="_blank" rel="noopener noreferrer">nextjs-babel</a>, <a href="https://github.com/lingui/js-lingui/tree/main/examples/nextjs-swc" target="_blank" rel="noopener noreferrer">nextjs-swc</a>, <a href="https://github.com/lingui/js-lingui/tree/main/examples/vite-project-react-babel" target="_blank" rel="noopener noreferrer">vite-project-react-babel</a>, <a href="https://github.com/lingui/swc-plugin/tree/main/examples/nextjs-13" target="_blank" rel="noopener noreferrer">nextjs-13</a> as well as the existing ones <a href="https://github.com/lingui/js-lingui/tree/main/examples/create-react-app" target="_blank" rel="noopener noreferrer">create-react-app</a> and <a href="https://github.com/lingui/js-lingui/tree/main/examples/js" target="_blank" rel="noopener noreferrer">js</a> were updated.</p>
<p>These example projects are a great resource for developers who are new to Lingui and want to see how it can be used in practice. They provide a clear starting point for building a multilingual application, and can help developers avoid common pitfalls and obstacles. We hope that these examples will inspire developers to try Lingui in their own projects and make their applications accessible to a wider audience.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="other-features">Other features<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#other-features" class="hash-link" aria-label="Direct link to Other features" title="Direct link to Other features">​</a></h2>
<p>Lingui v4 comes with a long list of useful features:</p>
<ul>
<li>extractor: support TS experimental decorators</li>
<li>macro: support tagged templates in <code>defineMessage</code> + short alias</li>
<li>macro: allow passing any expression as custom i18n instance</li>
<li>macro: support JSX macro inside conditional expressions</li>
<li>macro: support renamed identifiers in macro</li>
<li>core (Experimental): new core API for Node/JS usage without macros</li>
<li>core: support extracting from all forms of <code>i18n._</code> / <code>i18n.t</code> calls</li>
<li>extractor: respect sourcemaps</li>
</ul>
<p>Visit the <a href="https://github.com/lingui/js-lingui/releases/tag/v4.0.0" target="_blank" rel="noopener noreferrer">Release notes</a> to see all the updates.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="credits">Credits<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#credits" class="hash-link" aria-label="Direct link to Credits" title="Direct link to Credits">​</a></h2>
<p>We would like to say thanks to all the <a href="https://github.com/lingui/js-lingui/graphs/contributors" target="_blank" rel="noopener noreferrer">contributors</a> who made this release possible. It represents the hard work and dedication of a global community of developers who have contributed their time, expertise, and support.</p>
<p>We are also grateful to the entire community who provided valuable feedback, bug reports, and feature requests. Your contributions have helped shape and make Lingui better.</p>
<h2 class="anchor anchorWithStickyNavbar_LWe7" id="see-more">See more<a href="https://lingui.dev/blog/2023/04/26/announcing-lingui-4.0#see-more" class="hash-link" aria-label="Direct link to See more" title="Direct link to See more">​</a></h2>
<ul>
<li><a href="https://lingui.dev/releases/migration-4" target="_blank" rel="noopener noreferrer">Migration guide from 3.x to 4.x</a></li>
<li><a href="https://github.com/lingui/js-lingui/releases/tag/v4.0.0" target="_blank" rel="noopener noreferrer">Lingui 4.0 full changelog</a></li>
</ul>]]></content:encoded>
            <category>release</category>
        </item>
    </channel>
</rss>