Skip to content

Commit

Permalink
Merge pull request #893 from brave/copy-source-lang
Browse files Browse the repository at this point in the history
Copy locales to the correct location
  • Loading branch information
bbondy committed Nov 13, 2018
1 parent 4993335 commit 594b688
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 17 deletions.
50 changes: 36 additions & 14 deletions components/brave_rewards/resources/extension/BUILD.gn
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import("//build/config/locales.gni")
import("//extensions/buildflags/buildflags.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
Expand All @@ -23,21 +24,42 @@ grit("resources") {
}

if (is_mac) {
bundle_data("framework_bundle_data") {
sources = [
"brave_rewards/_locales/en/messages.json",
"brave_rewards/_locales",
]
outputs = [ "{{bundle_resources_dir}}/brave_rewards/{{source_file_part}}" ]
group("framework_bundle_data") {
deps = []
foreach(locale, locales) {
deps += [":framework_bundle_data_${locale}"]
}
}
} else {
copy("locales") {
sources = [
"brave_rewards/_locales/en/messages.json",
]

outputs = [
"$root_out_dir/resources/brave_rewards/_locales/en/{{source_file_part}}",
]
foreach(locale, locales) {
bundle_data("framework_bundle_data_${locale}") {
locale = string_replace(locale, "-", "_")
locale = string_replace(locale, "nb", "no")
sources = [
"brave_rewards/_locales/$locale/messages.json"
]
outputs = [
"{{bundle_resources_dir}}/brave_rewards/_locales/$locale/{{source_file_part}}"
]
}
}
} else {
group("locales") {
deps = []
foreach(locale, locales) {
deps += [":locales_${locale}"]
}
}
foreach(locale, locales) {
copy("locales_${locale}") {
locale = string_replace(locale, "-", "_")
locale = string_replace(locale, "nb", "no")
sources = [
"brave_rewards/_locales/${locale}/messages.json",
]
outputs = [
"$root_out_dir/resources/brave_rewards/_locales/${locale}/{{source_file_part}}",
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "Brave Rewards",
"manifest_version": 2,
"description": "Brave Rewards Extension",
"default_locale": "en",
"default_locale": "en_US",
"background" : {
"scripts": ["out/brave_rewards_panel_background.bundle.js"],
"persistent": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<release seq="1">
<includes>
<include name="IDR_BRAVE_REWARDS" file="brave_rewards/manifest.json" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_LOCALES_EN" file="brave_rewards/_locales/en/messages.json" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_LOCALES_EN_US" file="brave_rewards/_locales/en_US/messages.json" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_PANEL_HTML" file="brave_rewards/brave_rewards_panel.html" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_PANEL_BUNDLE_JS" file="brave_rewards/out/brave_rewards_panel.bundle.js" type="BINDATA" />
<include name="IDR_BRAVE_REWARDS_PANEL_BACKGROUND_JS" file="brave_rewards/out/brave_rewards_panel_background.bundle.js" type="BINDATA" />
Expand Down
1 change: 0 additions & 1 deletion script/lib/transifex.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,6 @@ def pull_source_files_from_transifex(source_file_path, filename):
langs_dir_path = os.path.dirname(os.path.dirname(source_file_path))
lang_codes = set(os.listdir(langs_dir_path))
lang_codes.discard('en_US')
lang_codes.discard('en')
lang_codes.discard('.DS_Store')
for lang_code in lang_codes:
print 'getting filename %s for lang_code %s' % (filename, lang_code)
Expand Down

0 comments on commit 594b688

Please sign in to comment.