Project

General

Profile

Feature #15454

Improve PO rules: Add check for square bracket count

Added by emmapeel over 1 year ago. Updated 6 days ago.

Status:
Confirmed
Priority:
Low
Assignee:
-
Category:
Internationalization
Target version:
-
Start date:
03/23/2018
Due date:
% Done:

0%

Feature Branch:
Type of work:
Communicate
Blueprint:
Starter:
Affected tool:
Translation Platform

Description

Our beautiful translators are human after all, and sometimes they don't copy the ikiwiki syntax quite right.

A simple check could be added to make sure the source and target strings have the same amount of [ and ] characters.

Reasoning:

- If there is an error on the number of brackets, ikiwiki will build without errors but the interface will be broken.

History

#1 Updated by u over 1 year ago

  • Subject changed from New check to check_po.sh: Check [ and ] characters to New check to check_po.sh: Check for square bracket count
  • Assignee set to u
  • Target version set to Tails_3.8
  • QA Check deleted (Dev Needed)

#2 Updated by u over 1 year ago

  • Subject changed from New check to check_po.sh: Check for square bracket count to Improve check_po.sh: Add check for square bracket count

#3 Updated by u over 1 year ago

#4 Updated by u over 1 year ago

If we add more such checks to check_po.sh we will soon saturate what this file does. It's written in bash after all. But let's keep this ticket somewhere, and eventually create some tools for translators who translate using vim or similar at some point.

#5 Updated by u over 1 year ago

  • Subject changed from Improve check_po.sh: Add check for square bracket count to Improve PO rules: Add check for square bracket count

We might want to add such a check in unify_po_headers.sh instead (this file makes our PO files comply to our rules) and change it's name..

#6 Updated by u over 1 year ago

Feel free to improve upon:


#!/bin/sh
# -*- mode: sh; sh-basic-offset: 4; indent-tabs-mode: nil; -*-
# vim: set filetype=sh sw=4 sts=4 expandtab autoindent:
# Usage: ./check_matching_brackets [2-letter language code]

set -e

if [ $# -ge 1 ] ; then
    FILE_GLOB="*.${1}.po" 
else
    FILE_GLOB='*.po'
fi

CPUS=$(egrep '^processor[[:space:]]+:' /proc/cpuinfo | wc -l)

# FNAME is full path (./pathto/file.inital.de.po)
# BASENAME is only the name of the file (file.inital.de.po)
# BASENAME1 is the name without po (file.inital.de)
# LANG the language we expect (de)

find -wholename ./tmp -prune -o \( -iname "$FILE_GLOB" -print0 \) \
        | xargs -0 --max-procs="$CPUS" --max-args=64 -I {} \
        awk -v RS= '{if (split($i,a,"[") != split($i,b,"]")) {print "\n"FILENAME"\n"": "$0}}' "{}" 

This does mostly work, but we have very weird splits in the po files sometimes which have [[ and ]] in different msgstrings.

#7 Updated by intrigeri about 1 year ago

  • Target version changed from Tails_3.8 to Tails_3.9

#8 Updated by u about 1 year ago

  • Assignee deleted (u)

I'm not interested in implementing this.

#9 Updated by intrigeri about 1 year ago

  • Target version deleted (Tails_3.9)

#10 Updated by intrigeri 3 months ago

  • Affected tool set to Translation Platform

#11 Updated by intrigeri 3 months ago

#12 Updated by intrigeri 6 days ago

  • Type of work changed from Code to Communicate

Next step: request this feature upstream.

Also available in: Atom PDF