If you already have the localised strings file, you need to add bundle_data target and dependency on those targets. You'll have to create one bundle_data target per locale (due to a limitation of gn source_expansion, see
https://crbug.com/608382, bug is marked as WNF as we do not use strings file in Chrome so was not considered important to fix).
Something like this should work:
source_set("target_using_localized_strings") {
sources = [ ... ]
deps = [ ":localized_strings" ]
}
_locales = [ "en", "fr", ... ]
group("localized_strings") {
public_deps = []
foreach(_locale, _locales) {
public_deps += [ ":localized_strings_$_locale" ]
}
}
foreach(_locale, _locales) {
bundle_data("localized_strings_$_locale") {
visibility = [ ":localized_strings" ]
sources = [ "strings/$_locale.lproj/MyAppString.strings" ]
outputs = [ "{{bundle_resources_dir}}/$_locale.lproj/{{source_file_part}}" ]
}
}
There is no support to extract the strings from source code and generate the first strings file however (i.e. we do not have tools to parse source code to look for uses of NSLocalizedString macro).
Regards,
-- Sylvain