| # Copyright 2020 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components.gni") |
| |
| # [START imports] |
| import("//build/intl/intl_strings.gni") |
| |
| # [END imports] |
| |
| # [START canonical_targets] |
| group("example") { |
| testonly = true |
| deps = [ ":pkg" ] |
| } |
| |
| # [END canonical_targets] |
| |
| # [START exec] |
| executable("src_intl_example_bin") { |
| sources = [ "main.cc" ] |
| output_name = "src_intl_example" |
| |
| # [START deps] |
| deps = [ |
| "//sdk/lib/syslog/cpp", |
| "//src/lib/intl/lookup/cpp:lib", |
| "//third_party/googletest:gtest_prod", |
| |
| # This is the underlying generated FIDL code, must be included so that |
| # its settings make it to the -I flag for compiler invocation. |
| # Generate all needed intermediate resources. |
| ":fuchsia.intl.l10n", |
| ":l10n", |
| ] |
| |
| # [END deps] |
| } |
| |
| # [START exec] |
| |
| # [START pkg] |
| fuchsia_package_with_single_component("pkg") { |
| package_name = "src-intl-example" |
| component_name = package_name |
| manifest = "meta/src-intl-example.cml" |
| |
| # [START pkg_deps] |
| deps = [ |
| # The binary to bundle in the package |
| ":src_intl_example_bin", |
| ] |
| |
| # [END pkg_deps] |
| # [START resources] |
| deps += [ |
| # These declaration works, but need to be maintained manually. Work is |
| # underway to make the "package" target collect and apply the locale files |
| # automatically. |
| ":en-strings", |
| ":es-strings", |
| ":fr-strings", |
| |
| # Contains the necessary ICU data. |
| "//src/intl:icudtl", |
| ] |
| |
| # [END resources] |
| } |
| |
| resource("en-strings") { |
| data_deps = [ ":l10n" ] |
| sources = [ "$target_gen_dir/en/l10n.json" ] |
| outputs = [ "data/assets/locales/en/l10n.json" ] |
| } |
| |
| resource("fr-strings") { |
| data_deps = [ ":l10n" ] |
| sources = [ "$target_gen_dir/fr/l10n.json" ] |
| outputs = [ "data/assets/locales/fr/l10n.json" ] |
| } |
| |
| resource("es-strings") { |
| data_deps = [ ":l10n" ] |
| sources = [ "$target_gen_dir/es/l10n.json" ] |
| outputs = [ "data/assets/locales/es/l10n.json" ] |
| } |
| |
| # [END pkg] |
| |
| # [START strings] |
| intl_strings("l10n") { |
| source = "strings.xml" |
| source_locale = "en" |
| output_locales = [ |
| "en", |
| "fr", |
| "es", |
| ] |
| library = "fuchsia.intl.l10n" |
| } |
| # [END strings] |