How does Flexible Classroom support multiple languages?
Flexible Classroom currently supports Chinese, English, and Spanish. If you need to add more languages, find the language-related key value in the specified directory and modify it.
Multilingual configuration on Web
In the source code, the Classroom SDK and Proctor SDK, referred to as main SDKs, and plugins, including clicker, countdown, voter, and the ring letter IM module, have their own separate multi-language files. The specific modification method is as follows:
-
Main SDKs:
-
Add the corresponding language file in the TypeScript format under
packages/agora-classroom-sdk/src/infra/translate
. The file name must be unique. For example: -
Add the corresponding code in
packages/agora-classroom-sdk/src/infra/api/index.tsx
:For example, if you want to add Japanese, add a
jpn.ts
file underpackages/agora-classroom-sdk/src/infra/translate
andaddResourceBundle('jp', jp);
topackages/agora-classroom-sdk/src/infra/api/index.tsx
file.The parameters of
addResourceBundle()
should be unique and easy to match with a language.
-
-
Plugins:
-
Add a folder with an
index.ts
language file topackages/agora-plugin-gallery/src/gallery/answer/i18n
. The folder name must be unique. For example: -
Add a line of declaration and a line of corresponding code in
packages/agora-plugin-gallery/src/gallery/answer/i18n/config.ts
:For example, if you need to add Japanese, add a
jp
folder with theindex.ts
file underpackages/agora-plugin-gallery/src/gallery/answer/i18n
and thenimport jp from './jp';
declaration andaddResourceBundle(jp", jp);
topackages/agora-plugin-gallery/src/gallery/answer/i18n/config.ts
.The parameters of
addResourceBundle()
should be unique and easy to match with a language.
-
Multilingual configuration on Android
Add a directory for the corresponding language with a string.xml
file inside to the following directories. The folder name must be unique.
/AgoraClassSDK/src/main/res
/AgoraEduUIKit/src/main/res
For example, if you want to add Japanese, add a value-jp
folder, which contains a strings.xml
file.
Multilingual configuration on iOS
- Under
others
directory, copy an existing language directory, for example,en.Iproj
, and rename it to correspond to the new language, for example,jp.Iproj
. The folder name must be unique and easy to match with a language, and the suffix must be.lproj
. - Replace all strings in the
Localizable.strings
file undervalue
directory with values corresponding to the new language.
Before entering the room, AgoraUIBaseViews
sets the agora_ui_language
pointer of the global variable to the directory name corresponding to the new language.