Usage
- All the basics exemples are valid in React Native. You only have to replace html tags (
div
,h1
, etc.) byText
. - Since
Intl
api is not available in React Native, thecount
param will only return three types of plural keys:zero
,one
andmany
. Please adjust your json files accordingly.
import React, { Text, Button } from "react-native";
import { useState } from "react";
import { useT } from "talkr";
export default function MyComponent() {
const { T } = useT();
const [count, setCount] = useState(0);
return (
<>
<Text>{T("hello")}</Text>
<Text>
{T("user.describe.complex", { name: "joe", hobby: "coding" })}
</Text>
<Text>{T("message-count", { count })}</Text>
<Button onPress={() => setCount(count + 1)} title="+1" />
</>
);
}