Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
6b117c44
Commit
6b117c44
authored
Apr 24, 2019
by
Ken Paulson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added TranslationServer::get_loaded_locales to return an array of all locales…
Added TranslationServer::get_loaded_locales to return an array of all locales with a loaded Translation
parent
e9be53ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
0 deletions
+17
-0
translation.cpp
core/translation.cpp
+15
-0
translation.h
core/translation.h
+2
-0
No files found.
core/translation.cpp
View file @
6b117c44
...
...
@@ -968,6 +968,19 @@ String TranslationServer::get_locale_name(const String &p_locale) const {
return
locale_name_map
[
p_locale
];
}
Array
TranslationServer
::
get_loaded_locales
()
const
{
Array
locales
;
for
(
const
Set
<
Ref
<
Translation
>
>::
Element
*
E
=
translations
.
front
();
E
;
E
=
E
->
next
())
{
const
Ref
<
Translation
>
&
t
=
E
->
get
();
String
l
=
t
->
get_locale
();
locales
.
push_back
(
l
);
}
return
locales
;
}
Vector
<
String
>
TranslationServer
::
get_all_locales
()
{
Vector
<
String
>
locales
;
...
...
@@ -1168,6 +1181,8 @@ void TranslationServer::_bind_methods() {
ClassDB
::
bind_method
(
D_METHOD
(
"remove_translation"
,
"translation"
),
&
TranslationServer
::
remove_translation
);
ClassDB
::
bind_method
(
D_METHOD
(
"clear"
),
&
TranslationServer
::
clear
);
ClassDB
::
bind_method
(
D_METHOD
(
"get_loaded_locales"
),
&
TranslationServer
::
get_loaded_locales
);
}
void
TranslationServer
::
load_translations
()
{
...
...
core/translation.h
View file @
6b117c44
...
...
@@ -94,6 +94,8 @@ public:
String
get_locale_name
(
const
String
&
p_locale
)
const
;
Array
get_loaded_locales
()
const
;
void
add_translation
(
const
Ref
<
Translation
>
&
p_translation
);
void
remove_translation
(
const
Ref
<
Translation
>
&
p_translation
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment