我有一个svg图像作为React组件导入,如下所示: import {ReactComponent as img} from '../img/img_en.svg'; 但是我还有一个法语版本的图像,当用户选择法语作为语言时,我想渲染它。 import {ReactComponent as img} from '../img/img_fr.svg'; 你知道我该怎么做吗?我试着调查了一下,但没有成功。
我目前从用户的浏览器中获取区域设置。用户现在可以在他们的配置文件中设置他们的首选语言,这存储在数据库中。我想从数据库中获得这个值,并为i18next设置正确的语言环境。我在这里读到了一些关于自己的检测功能的内容:https://github.com/i18next/i18next-browser-languageDetector。但我不能完全确定这是否是正确的选择。我的i18n.js文件当前设置如下: import i18n from 'i18next';
import Backend from 'i18next-xhr-backend';
import La
我在尝试使用i18next on reactive 进行反应性转换时遇到了问题。
这些是重要的档案:
i18n/index.js
import i18next from 'i18next';
import en from './en.json';
import es from './es.json';
import it from './it.json';
const i18n = i18next.init({
interpolation: {
// React already does escaping
我试图通过根据条件(真或假)切换自定义复选框图像来模仿复选框的行为。我得到了一个非常恼人的视觉bug,当我将状态设置为真实或虚假的条件时,图像依赖于它,并且框在切换之前会有一点闪烁,这是我的代码:
import React from 'react';
import boxCheckedIcon from '../../../../assets/SmallBoxChecked.svg';
import boxUncheckedIcon from '../../../../assets/SmallBoxUnchecked.svg';
class
我正在尝试设置默认语言当用户第一次打开应用程序时,我使用的是i18next &react-I18下一种默认语言我想设置为ar,有没有一种方法可以在不需要用户操作的情况下将语言更改为ar
这是我的配置
import i18n from 'i18next';
import {initReactI18next} from 'react-i18next';
import {I18nManager} from 'react-native';
// the translations
const ar = require('./Lang/ar.
语言检测工作正常。所有字符串都被翻译成用户语言,但图像和输入占位符以默认语言显示。当我手动更改语言时,图像和占位符的翻译工作正常。 这就是我的i18n.js import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import LanguageDetector from 'i18next-browser-languagedetector';
import en from './locales/en.json';
import r
我有一个简单的应用程序,我使用i18next在我的应用程序中应用翻译。
这是我的i18next代码:
import i18n from 'i18next';
import {initReactI18next} from 'react-i18next';
import en from './en/en.json';
import ar from './ar/ar.json';
import he from './he/he.json';
import AsyncStorage from '@react-nat
我正在使用i18next翻译我的NextJs应用程序。翻译在我的浏览器中加载非常好,但在我的控制台中仍然很少看到错误。
i18next: hasLoadedNamespace: i18next was not initialized undefined
i18next::translator: key "resources.welcome_string.value" for languages "en-US" won't get resolved as namespace "myStrings" was not yet loaded Th