Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Add some docs

Manav Rathib213796628d8
diff --git a/packages/shared/i18n/index.ts b/packages/shared/i18n/index.ts
index 7f7665ff3b..c9ebf774f1 100644
--- a/packages/shared/i18n/index.ts
+++ b/packages/shared/i18n/index.ts
@@ -3,16 +3,30 @@ import { initReactI18next } from 'react-i18next';
import Backend from 'i18next-http-backend';
import { getBestPossibleUserLocale } from './utils';
+/**
+ * Load translations.
+ *
+ * Localization and related concerns (aka "internationalization", or "i18n") for
+ * our apps is handled by i18n framework.
+ *
+ * In addition to the base i18next package, we use two of its plugins:
+ *
+ * - i18next-http-backend, for loading the JSON files containin the translations
+ * at runtime, and
+ *
+ * - react-i18next, which adds React specific APIs
+ */
export const setupI18n = async () => {
+ // https://www.i18next.com/overview/api
await i18n
- // i18next-http-backend
- // loads translations from your server
- // https://github.com/i18next/i18next-http-backend,
+ // i18next-http-backend: Asynchronously loads translations over HTTP
+ // https://github.com/i18next/i18next-http-backend
.use(Backend)
- // pass the i18n instance to react-i18next.
+ // react-i18next: React support
+ // Pass the i18n instance to react-i18next.
.use(initReactI18next)
- // init i18next
- // for all options read: https://www.i18next.com/overview/configuration-options
+ // Initialize i18next
+ // Option docs: https://www.i18next.com/overview/configuration-options
.init({
returnEmptyString: false,
fallbackLng: 'en',