Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
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
edx
edx-platform
Commits
165e7059
Commit
165e7059
authored
May 08, 2013
by
Steve Strassmann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
guard predicates are rake tasks, not functions
parent
dfcbb736
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
48 deletions
+40
-48
rakefile
+40
-48
No files found.
rakefile
View file @
165e7059
...
...
@@ -510,51 +510,21 @@ end
# --- Internationalization tasks
# Make sure config file with username/password exists
# Returns boolean: returns true if file exists and is nonzero length
def
validate_transifex_config
()
config_file
=
"
#{
Dir
.
home
}
/.transifexrc"
if
!
File
.
file?
(
config_file
)
or
File
.
size
(
config_file
)
==
0
raise
"Cannot connect to Transifex, config file is missing or empty:
#{
config_file
}
\n
"
+
"See http://help.transifex.com/features/client/#transifexrc
\n
"
return
false
end
return
true
end
# Make sure GNU gettext utilities are available
# Returns boolean: returns true if utilities are available, else returns false
def
validate_gnu_gettext
()
begin
select_executable
(
'xgettext'
)
return
true
rescue
puts
"Error:"
.
red
puts
"Cannot locate GNU gettext utilities, which are required by django for internationalization."
.
red
puts
"(see https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files)"
.
red
puts
"Try downloading them from http://www.gnu.org/software/gettext/"
.
red
return
false
end
end
namespace
:i18n
do
desc
"Extract localizable strings from sources"
task
:extract
do
if
validate_gnu_gettext
()
sh
(
File
.
join
(
REPO_ROOT
,
"i18n"
,
"extract.py"
))
end
Rake
::
Task
[
"i18n:validate:gettext"
].
execute
sh
(
File
.
join
(
REPO_ROOT
,
"i18n"
,
"extract.py"
))
end
desc
"Compile localizable strings from sources. With optional flag 'extract', will extract strings first."
task
:generate
do
if
validate_gnu_gettext
()
if
ARGV
.
last
.
downcase
==
'extract'
Rake
::
Task
[
"i18n:extract"
].
execute
end
sh
(
File
.
join
(
REPO_ROOT
,
"i18n"
,
"generate.py"
))
Rake
::
Task
[
"i18n:validate:gettext"
].
execute
if
ARGV
.
last
.
downcase
==
'extract'
Rake
::
Task
[
"i18n:extract"
].
execute
end
sh
(
File
.
join
(
REPO_ROOT
,
"i18n"
,
"generate.py"
))
end
desc
"Simulate international translation by generating dummy strings corresponding to source strings."
...
...
@@ -567,30 +537,52 @@ namespace :i18n do
end
end
namespace
:validate
do
desc
"Make sure GNU gettext utilities are available"
task
:gettext
do
begin
select_executable
(
'xgettext'
)
rescue
msg
=
"Cannot locate GNU gettext utilities, which are required by django for internationalization.
\n
"
msg
+=
"(see https://docs.djangoproject.com/en/dev/topics/i18n/translation/#message-files)
\n
"
msg
+=
"Try downloading them from http://www.gnu.org/software/gettext/"
abort
(
msg
.
red
)
end
end
desc
"Make sure config file with username/password exists"
task
:transifex_config
do
config_file
=
"
#{
Dir
.
home
}
/.transifexrc"
if
!
File
.
file?
(
config_file
)
or
File
.
size
(
config_file
)
==
0
msg
=
"Cannot connect to Transifex, config file is missing or empty:
#{
config_file
}
\n
"
msg
+=
"See http://help.transifex.com/features/client/#transifexrc"
abort
(
msg
.
red
)
end
end
end
namespace
:transifex
do
desc
"Push source strings to Transifex for translation"
task
:push
do
if
validate_transifex_config
()
cmd
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"transifex.py"
)
sh
(
"
#{
cmd
}
push"
)
end
Rake
::
Task
[
"i18n:validate:transifex_config"
].
execute
cmd
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"transifex.py"
)
sh
(
"
#{
cmd
}
push"
)
end
desc
"Pull translated strings from Transifex"
task
:pull
do
if
validate_transifex_config
()
cmd
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"transifex.py"
)
sh
(
"
#{
cmd
}
pull"
)
end
Rake
::
Task
[
"i18n:validate:transifex_config"
].
execute
cmd
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"transifex.py"
)
sh
(
"
#{
cmd
}
pull"
)
end
end
desc
"Run tests for the internationalization library"
task
:test
do
if
validate_gnu_gettext
()
test
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"tests"
)
sh
(
"nosetests
#{
test
}
"
)
end
Rake
::
Task
[
"i18n:validate:gettext"
].
execute
test
=
File
.
join
(
REPO_ROOT
,
"i18n"
,
"tests"
)
sh
(
"nosetests
#{
test
}
"
)
end
end
...
...
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