Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multi lang generation support #7275

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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