Skip to content

Commit

Permalink
Merge pull request #7275 from braze-inc/update_rake_multi_lang
Browse files Browse the repository at this point in the history
Add multi lang generation support
  • Loading branch information
josh-mccrowell-braze authored Apr 30, 2024
2 parents 94bab6c + 218f802 commit 3d81172
Show file tree
Hide file tree
Showing 2 changed files with 96 additions and 13 deletions.
39 changes: 26 additions & 13 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,21 @@ namespace :docs_en do
end
end

namespace :docs_fr do
config_file = './_config.yml,./_lang/_config_fr.yml'
task :index do
namespace :lang do
task :index, [:lang] do |t, args|
config_file = "./_config.yml,./_lang/_config_#{args[:lang]}.yml"
if ENV["SITE_URL"] == 'https://www.braze.com' && ENV["RACK_ENV"] == 'production'
puts `bundle exec jekyll algolia --config #{config_file}`
end
end
task build: [:index] do
jekyll_build(config_file, 'fr')
task :build, [:lang] => [:index] do |t, args|
jekyll_build("./_config.yml,./_lang/_config_#{args[:lang]}.yml", args[:lang])
end
task :serve do
jekyll_serve(config_file)
task :serve, [:lang] do |t, args|
jekyll_serve("./_config.yml,./_lang/_config_#{args[:lang]}.yml")
end
task :proxy_serve do
pipe 'bundle exec ruby proxy.rb fr'
task :proxy_serve, [:lang] do |t, args|
pipe "bundle exec ruby proxy.rb #{args[:lang]}"
end
end

Expand All @@ -79,14 +79,27 @@ namespace :assets do
end
end

multitask fr: [
'docs_fr:serve', 'docs_fr:proxy_serve'

# Usage: rake "lang[:lang]" ie
# rake "lang[:fr]"
# rake "lang[:ja]"
multitask :lang, [:lang] => [
'lang:serve',
'lang:proxy_serve'
]

multitask en: [
multitask serve: [
'docs_en:serve', 'docs_en:proxy_serve'
]

multitask serve: [
multitask en: [
'docs_en:serve', 'docs_en:proxy_serve'
]

task :fr do
Rake::Task["lang"].invoke('fr')
end

task :ja do
Rake::Task["lang"].invoke('ja')
end
70 changes: 70 additions & 0 deletions _lang/_config_ja.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# Site settings
title: Braze Documentation
email: success@braze.com
description: >- # this means to ignore newlines until "baseurl:"
Welcome to Braze Documentation. Braze provides a comprehensive user engagement solution for your mobile apps.
baseurl: "/docs/ja" # the subpath of your site, e.g., /blog
homeurl: "https://www.braze.com" # the base hostname & protocol for your site, e.g., http://example.com
twitter_username: Braze
github_username: braze-inc

language: ja

destination: _site/docs/ja

# Source dir
source: '.'

lab_index_name: "DocSearch_Japan"

# Allows the DocSearch element to be inspected. Set to true locally, but don't
# check in in that state, or it will cause undesirable behavior in prod.
search_debug: false

# For local testing, set to false to increase build time by not pulling partner api
# and markdown data. MAKE SURE TO TURN BACK ON PRIOR TO COMMIT.
partner_api: true
markdown_api: true

# GitHub config
github_baseurl: 'https://github.com/braze-inc/braze-docs/blob/develop/_lang/ja/'

# Collections directory
collections_dir: _lang/ja/


collections:
home:
title: ドキュメンテーション
user_guide:
title: ユーザーガイド
developer_guide:
title: 開発者ガイド
api:
title: API
default_nav_url: basics/
partners:
title: テクノロジーパートナー
help:
title: ヘルプ
hidden: # Hidden pages not directly linked via navigation
title: Braze
docs_pages: # Site specific pages. ie main redirects and search
title: Braze


# Image asset pipeline setting for japr
asset_pipeline:
display_path: docs/ja/assets

# Algolia Search index
algolia:
index_name: "DocSearch_Japan"
files_to_exclude:
- _lang/ja/_hidden/*
- _lang/ja/_hidden/*/* #exclude hidden subdirectories from indexing
- _lang/ja/_hidden/*/*/* #exclude additional hidden subdirectories from indexing
- _lang/ja/_docs_pages/*
- _lang/ja/_docs_pages/*/* #exclude hidden subdirectories from indexing
- _lang/ja/_docs_pages/*/*/* #exclude additional hidden subdirectories from indexing
- _lang/ja/_home/Styling_Test_Page.md

0 comments on commit 3d81172

Please sign in to comment.