i18next-locize-backend
pages-gem
Our great sponsors
i18next-locize-backend | pages-gem | |
---|---|---|
6 | 586 | |
68 | 1,808 | |
- | 0.7% | |
6.4 | 8.1 | |
7 days ago | about 1 month ago | |
JavaScript | Ruby | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
i18next-locize-backend
-
How to properly internationalize a Vue application using i18next
import I18NextVue from 'i18next-vue' import i18next from 'i18next' import Backend from 'i18next-locize-backend' import LanguageDetector from 'i18next-browser-languagedetector' import LastUsed from 'locize-lastused' import { locizePlugin } from 'locize' const isProduction = process.env.NODE_ENV === 'production' const locizeOptions = { projectId: process.env.VUE_APP_LOCIZE_PROJECTID, apiKey: process.env.VUE_APP_LOCIZE_APIKEY, // YOU should not expose your apps API key to production!!! version: process.env.VUE_APP_LOCIZE_VERSION } if (!isProduction) { // locize-lastused // sets a timestamp of last access on every translation segment on locize // -> safely remove the ones not being touched for weeks/months // https://github.com/locize/locize-lastused i18next.use(LastUsed); } export const i18nextPromise = i18next // locize-editor // InContext Editor of locize .use(locizePlugin) // i18next-locize-backend // loads translations from your project, saves new keys to it (saveMissing: true) // https://github.com/locize/i18next-locize-backend .use(Backend) // detect user language // learn more: https://github.com/i18next/i18next-browser-languageDetector .use(LanguageDetector) // init i18next // for all options read: https://www.i18next.com/overview/configuration-options .init({ debug: !isProduction, fallbackLng: 'en', saveMissing: !isProduction, backend: locizeOptions, locizeLastUsed: locizeOptions }) export default function (app) { app.use(I18NextVue, { i18next }) return app }
-
All side optimized Next.js translations
We will use the i18next-locize-backend plugin, but only on client side.
-
How to internationalize a Remix application (Part 2)
import { hydrate } from 'react-dom' import { RemixBrowser } from 'remix' import i18next from 'i18next' import LanguageDetector from 'i18next-browser-languagedetector' import { initReactI18next } from 'react-i18next' import Backend from 'i18next-locize-backend' import LastUsed from 'locize-lastused' import { locizePlugin } from 'locize' import i18nextOptions from './i18nextOptions' const isProduction = process.env.NODE_ENV === 'production' const locizeOptions = { projectId: 'f6d74b76-9677-4a0d-b400-86e1507397ab', apiKey: !isProduction ? '1c2bbc21-027d-4f41-995a-e8beb451cdef' : undefined, // YOU should not expose your apps API key to production!!! version: isProduction ? 'production' : 'latest' } if (!isProduction) { // locize-lastused // sets a timestamp of last access on every translation segment on locize // -> safely remove the ones not being touched for weeks/months // https://github.com/locize/locize-lastused i18next.use(LastUsed) } // initialize i18next using initReactI18next and configuring it if (!i18next.isInitialized) { // prevent i18next to be initialized multiple times i18next // locize-editor // InContext Editor of locize .use(locizePlugin) // i18next-locize-backend // loads translations from your project, saves new keys to it (saveMissing: true) // https://github.com/locize/i18next-locize-backend .use(Backend) // detect user language // learn more: https://github.com/i18next/i18next-browser-languageDetector .use(LanguageDetector) // pass the i18n instance to react-i18next. .use(initReactI18next) // init i18next // for all options read: https://www.i18next.com/overview/configuration-options .init({ ...i18nextOptions, detection: { caches: ['cookie'], lookupCookie: 'i18next' }, backend: locizeOptions, locizeLastUsed: locizeOptions, saveMissing: !isProduction // you should not use saveMissing in production }) .then(() => { // then hydrate your app wrapped in the RemixI18NextProvider return hydrate( , document ) }) }
-
The progressive guide to jQuery internationalization (i18n) using i18next
const getGreetingTime = () => { const split_afternoon = 12; // 24hr time to split the afternoon const split_evening = 17; // 24hr time to split the evening const currentHour = moment().hour(); if (currentHour >= split_afternoon && currentHour <= split_evening) { return 'afternoon'; } else if (currentHour >= split_evening) { return 'evening'; } return 'morning'; } const rerender = () => { // start localizing, details: // https://github.com/i18next/jquery-i18next#usage-of-selector-function $('body').localize(); $('#footerMessage').localize({ context: getGreetingTime() }); $('title').text($.t('head.title')) $('meta[name=description]').attr('content', $.t('head.description')) } const locizeOptions = { projectId: '8d751621-323e-4bda-94c8-7d2368102e62', apiKey: '302aca54-2ea8-4b9f-b5f0-df1369c59427' // YOU should not expose your apps API key to production!!! }; i18next.on('editorSaved', rerender); // used for the inContext editor $(function () { const locizeBackend = new i18nextLocizeBackend(locizeOptions, (err, opts, lngs) => { if (err) return console.error(err); // use plugins and options as needed, for options, detail see // https://www.i18next.com i18next // locize-editor // InContext Editor of locize .use(locize.locizePlugin) // locize-lastused (do not use this in production) // sets a timestamp of last access on every translation segment on locize // -> safely remove the ones not being touched for weeks/months // https://github.com/locize/locize-lastused .use(locizeLastUsed) // i18next-locize-backend // loads translations from your project, saves new keys to it (saveMissing: true) // https://github.com/locize/i18next-locize-backend .use(locizeBackend) // detect user language // learn more: https://github.com/i18next/i18next-browser-languageDetector .use(i18nextBrowserLanguageDetector) // init i18next // for all options read: https://www.i18next.com/overview/configuration-options .init({ ...opts, debug: true, fallbackLng: 'en', backend: locizeOptions, locizeLastUsed: locizeOptions, saveMissing: true // interpolation: { // // legacy usage // format: (value, format, lng) => { // if (value instanceof Date) { // return moment(value).locale(lng).format(format); // } // return value; // } // } }, (err, t) => { if (err) return console.error(err); // new usage i18next.services.formatter.add('LLLL', (value, lng, options) => { return moment(value).locale(lng).format('LLLL'); }); // for options see // https://github.com/i18next/jquery-i18next#initialize-the-plugin jqueryI18next.init(i18next, $, { useOptionsAttr: true }); // fill language switcher Object.keys(lngs).map((lng) => { const opt = new Option(lngs[lng].nativeName, lng); if (lng === i18next.resolvedLanguage) { opt.setAttribute("selected", "selected"); } $('#languageSwitcher').append(opt); }); let languageChangedCounter = 0; $('#languageSwitcher').change((a, b, c) => { const chosenLng = $(this).find("option:selected").attr('value'); i18next.changeLanguage(chosenLng, () => { rerender(); // language changed message languageChangedCounter++; $('#languageChangedNotification').localize({ count: languageChangedCounter }) if (languageChangedCounter === 1) { $('#languageChangedNotification').show(); } }); }); rerender(); $('#loader').hide(); $('#content').show(); }); }); });
-
How does server side internationalization (i18n) look like?
Alternatively, use i18next-locize-backend instead of the i18next-fs-backend. If you're running your code in a serverless environment, make sure you read this advice first!
-
How to properly internationalize a React application using i18next
import i18n from 'i18next'; import { initReactI18next } from 'react-i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import Backend from 'i18next-locize-backend'; import LastUsed from 'locize-lastused'; import { locizePlugin } from 'locize'; import { DateTime } from 'luxon'; const isProduction = process.env.NODE_ENV === 'production'; const locizeOptions = { projectId: process.env.REACT_APP_LOCIZE_PROJECTID, apiKey: process.env.REACT_APP_LOCIZE_APIKEY, // YOU should not expose your apps API key to production!!! referenceLng: process.env.REACT_APP_LOCIZE_REFLNG, version: process.env.REACT_APP_LOCIZE_VERSION }; if (!isProduction) { // locize-lastused // sets a timestamp of last access on every translation segment on locize // -> safely remove the ones not being touched for weeks/months // https://github.com/locize/locize-lastused i18n.use(LastUsed); } i18n // locize-editor // InContext Editor of locize .use(locizePlugin) // i18next-locize-backend // loads translations from your project, saves new keys to it (saveMissing: true) // https://github.com/locize/i18next-locize-backend .use(Backend) // detect user language // learn more: https://github.com/i18next/i18next-browser-languageDetector .use(LanguageDetector) // pass the i18n instance to react-i18next. .use(initReactI18next) // init i18next // for all options read: https://www.i18next.com/overview/configuration-options .init({ debug: true, fallbackLng: 'en', interpolation: { escapeValue: false, // not needed for react as it escapes by default format: (value, format, lng) => { if (value instanceof Date) { return DateTime.fromJSDate(value).setLocale(lng).toLocaleString(DateTime[format]) } return value; } }, backend: locizeOptions, locizeLastUsed: locizeOptions, saveMissing: !isProduction // you should not use saveMissing in production }); export default i18n;
pages-gem
-
How to build your interactive resume in 4 simple and 2 easy steps
It's super easy to publish a static site like the resume with GitHub Pages. Just check out the docs.
-
100+ FREE Resources Every Web Developer Must Try
GitHub Pages: Host your static websites directly from your GitHub repository.
-
Ask HN: Looking for lightweight personal blogging platform
As per many other comments, it sounds like a static site generator like Hugo (https://gohugo.io/) or Jekyll (https://jekyllrb.com/), hosted on GitHub Pages (https://pages.github.com/) or GitLab Pages (https://about.gitlab.com/stages-devops-lifecycle/pages/), would be a good match. If you set up GitHub Actions or GitLab CI/CD to do the build and deploy (see e.g. https://gohugo.io/hosting-and-deployment/hosting-on-github/), your normal workflow will simply be to edit markdown and do a git push to make your changes live. There are a number of pre-built themes (e.g. https://themes.gohugo.io/) you can use, and these are realtively straightforward to tweak to your requirements.
-
Top 20 Free Static Web Hosting Services in 2024 ⚡️
Ideal for open source projects, docs sites, and portfolios. GitHub Pages
-
Creating an Engaging Curriculum vitae using Github Pages: A Step-by-Step Guide
Github Pages: Link to Github Pages
-
Different Levels of Project Documentation
Once you have all the documentation worked out a place to host it will be necessary. Some documentation generation may have ties in with specific hosting sites. Read The Docs' support for Sphinx and other documentation tools is one example. GitHub pages can be useful for GitHub hosted projects as it integrates well with GitHub Actions CI/CD deployments.
-
The minimalist guide to deploying a website in 2023 🧘
If you use GitHub and need to host a static website, consider GitHub Pages. Free for one site Stored on a GitHub public respository Deploy via web interface, or Git 100GB/month free bandwidth
-
I made a simple website 100% for FREE! 🤯
https://pages.github.com/ https://docs.github.com/en/pages https://docs.github.com/en/pages/quickstart https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/about-github-pages-and-jekyll
-
How to host my own website from GitHub
There are plenty of other hosting options you could use instead, such as GitHub Pages.
-
A page to see all revealed Affliction Gems at once
Functionally github.io just presents whatever you throw into the repository as the root directory of a site, github themselves host a very good, basic outline of how to set up a site on github.io.
What are some alternatives?
react-i18next - Internationalization for react done right. Using the i18next i18n ecosystem.
al-folio - A beautiful, simple, clean, and responsive Jekyll theme for academics
i18next-http-backend - i18next-http-backend is a backend layer for i18next using in Node.js, in the browser and for Deno.
neocities - Neocities.org - the web site. The entire thing. Yep, we're completely open source.
locize-cli - locize cli to import / export locales, add / edit / remove, sync segments
Jekyll - :globe_with_meridians: Jekyll is a blog-aware static site generator in Ruby
remix-i18next - The easiest way to translate your Remix apps
Hugo - The world’s fastest framework for building websites.
i18next-chained-backend - An i18next backend to chain multiple backends (add fallbacks, caches, ...)
Docusaurus - Easy to maintain open source documentation websites.
create-react-app - Set up a modern web app by running one command.
git - A fork of Git containing Windows-specific patches.