Skip to content
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
60 changes: 50 additions & 10 deletions i18n-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,6 @@
"es": "-",
"pt-BR": "-"
},
{
"name": "command_reference.md",
"en": "Completed",
"zh-CN": "-",
"de": "translated by @sebastian-xyz",
"tr": "-",
"ja": "-",
"es": "-",
"pt-BR": "-"
},
{
"name": "command_signature.md",
"en": "In progress",
Expand Down Expand Up @@ -159,6 +149,26 @@
"es": "-",
"pt-BR": "-"
},
{
"name": "default_shell.md",
"en": "In progress",
"zh-CN": "-",
"de": "-",
"tr": "-",
"ja": "-",
"es": "-",
"pt-BR": "-"
},
{
"name": "design_notes.md",
"en": "In progress",
"zh-CN": "-",
"de": "-",
"tr": "-",
"ja": "-",
"es": "-",
"pt-BR": "-"
},
{
"name": "environment.md",
"en": "Completed",
Expand Down Expand Up @@ -219,6 +229,16 @@
"es": "-",
"pt-BR": "-"
},
{
"name": "how_nushell_code_gets_run.md",
"en": "In progress",
"zh-CN": "-",
"de": "-",
"tr": "-",
"ja": "-",
"es": "-",
"pt-BR": "-"
},
{
"name": "installation.md",
"en": "Completed",
Expand Down Expand Up @@ -449,6 +469,16 @@
"es": "-",
"pt-BR": "-"
},
{
"name": "standard_library.md",
"en": "In progress",
"zh-CN": "-",
"de": "-",
"tr": "-",
"ja": "-",
"es": "-",
"pt-BR": "-"
},
{
"name": "stdout_stderr_exit_codes.md",
"en": "Completed",
Expand All @@ -469,6 +499,16 @@
"es": "-",
"pt-BR": "-"
},
{
"name": "testing.md",
"en": "In progress",
"zh-CN": "-",
"de": "-",
"tr": "-",
"ja": "-",
"es": "-",
"pt-BR": "-"
},
{
"name": "thinking_in_nu.md",
"en": "Completed",
Expand Down
56 changes: 29 additions & 27 deletions i18n.nu
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ let META_FILE = 'i18n-meta.json'
if ($META_FILE | path exists) == false {
echo '[]' | save -r $META_FILE
}
let meta = open $META_FILE
let meta = (open $META_FILE)

# Check if a git repo has the specified ref: could be a branch or tag, etc.
def 'has-ref' [
Expand All @@ -19,17 +19,20 @@ def update-i18n-status [] {
print "The following table holds the overview of the Nushell docs’ writing and translation status. Welcome to participate in the translation of the docs. And please update the `i18n-meta.json` file after you have finished writing or translating the doc. Thanks"
print $'(char nl)---(char nl)'

ls -s book/*.md
| where type == file
| select name
| upsert en {|it| get-cell $it.name en }
| upsert zh-CN {|it| get-cell $it.name zh-CN }
| upsert de {|it| get-cell $it.name de }
| upsert tr {|it| get-cell $it.name tr }
| upsert ja {|it| get-cell $it.name ja }
| upsert es {|it| get-cell $it.name es }
| upsert pt-BR {|it| get-cell $it.name pt-BR }
| to md --pretty
let status = (
ls -s book/*.md
| where type == file
| select name
| upsert en {|it| get-cell $it.name en }
| upsert zh-CN {|it| get-cell $it.name zh-CN }
| upsert de {|it| get-cell $it.name de }
| upsert tr {|it| get-cell $it.name tr }
| upsert ja {|it| get-cell $it.name ja }
| upsert es {|it| get-cell $it.name es }
| upsert pt-BR {|it| get-cell $it.name pt-BR }
| to md --pretty
)
print $status

print $'(char nl)Possible status values: `-`,`Completed`,`In Progress`,`Being translated by @ABC`, `commit_id@author` or simply a COMMIT ID indicate your translation end to.(char nl)'
}
Expand Down Expand Up @@ -122,22 +125,21 @@ def main [
lng?: string # The locale to check outdated: zh-CN, de, etc.
] {
let locales = ['zh-cn', 'de', 'tr', 'ja', 'es', 'pt-br']

if $task == 'gen' {
gen-i18n-meta
} else if $task == 'update' {
update-i18n-status
} else if $task == 'outdated' {
if ($lng | is-empty) {
$'(ansi r)A locale code required, available locales: ($locales), Please try again!(ansi reset)(char nl)'
exit --now
}
let available = ($lng | str downcase) in $locales
if (not $available) {
$'(ansi r)Unsupported locale, available locales: ($locales), Please try again!(ansi reset)(char nl)'
exit --now
match $task {
'gen' => { gen-i18n-meta },
'update' => { update-i18n-status },
'outdated' => {
if ($lng | is-empty) {
print $'(ansi r)A locale code required, available locales: ($locales), Please try again!(ansi reset)(char nl)'
exit --now
}
let available = ($lng | str downcase) in $locales
if (not $available) {
print $'(ansi r)Unsupported locale, available locales: ($locales), Please try again!(ansi reset)(char nl)'
exit --now
}
check-outdated-translation $lng
}
check-outdated-translation $lng
}
}