Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jonny Borges
2020-07-18 13:28:42 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2020-07-18 13:28:42 -0300
Commit
185ae9ba48067d2e0d7930e3d06e347a426b28aa
185ae9ba
1 parent
1e31572a
Added comments to language extensions
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
lib/src/root/root_widget.dart
lib/src/root/root_widget.dart
View file @
185ae9b
...
...
@@ -257,16 +257,22 @@ abstract class Translations {
extension
Trans
on
String
{
String
get
tr
{
// Returns the key if locale is null.
if
(
Get
.
locale
?.
languageCode
==
null
)
return
this
;
// Checks whether the language code and country code are present, and whether the key is also present.
if
(
Get
.
translations
.
containsKey
(
"
${Get.locale.languageCode}
_
${Get.locale.countryCode}
"
)
&&
Get
.
translations
[
"
${Get.locale.languageCode}
_
${Get.locale.countryCode}
"
]
.
containsKey
(
this
))
{
return
Get
.
translations
[
"
${Get.locale.languageCode}
_
${Get.locale.countryCode}
"
][
this
];
// Checks if there is a callback language in the absence of the specific country, and if it contains that key.
}
else
if
(
Get
.
translations
.
containsKey
(
Get
.
locale
.
languageCode
)
&&
Get
.
translations
[
Get
.
locale
.
languageCode
].
containsKey
(
this
))
{
return
Get
.
translations
[
Get
.
locale
.
languageCode
][
this
];
// If there is no corresponding language or corresponding key, return the key.
}
else
{
return
this
;
}
...
...
Please
register
or
login
to post a comment