-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f3d1e42
commit 73ed7fd
Showing
4 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
app/src/main/java/io/agora/flat/common/android/I18NFetcher.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.agora.flat.common.android | ||
|
||
import android.content.Context | ||
import dagger.hilt.android.qualifiers.ApplicationContext | ||
import io.agora.flat.R | ||
import javax.inject.Inject | ||
import javax.inject.Singleton | ||
|
||
@Singleton | ||
class I18NFetcher @Inject constructor(@ApplicationContext context: Context) { | ||
companion object { | ||
const val JOIN_ROOM_RECORD_PMI_TITLE = "join_room_record_pmi_title" | ||
|
||
val map = mapOf( | ||
JOIN_ROOM_RECORD_PMI_TITLE to R.string.join_room_record_pmi_title | ||
) | ||
} | ||
|
||
private val resources = context.resources | ||
|
||
fun getString(key: String): String { | ||
val resId = map[key] ?: return "" | ||
return resources.getString(resId) | ||
} | ||
|
||
fun getString(key: String, vararg formatArgs: Any?): String { | ||
val resId = map[key] ?: return "" | ||
return resources.getString(resId, *formatArgs) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters