Diff util for language .ini

Currently, most translation projects lack continuous maintenance.

One main reason is that with version updates, it’s difficult to check which fields have been added in .ini files.

Now there is a tool trying to solve this problem

If you can handle Python (It doesn’t need to be too complicated), you can do this:

from aseprite_ini import Aseini

def main():
    # Get the latest main branch en.ini strings 
    strings_en = Aseini.pull_strings('main')
    # Fallback strategy to compat old version, although this may not necessarily be effective
    strings_en.fallback(Aseini.pull_strings('v1.3-rc4'))
    strings_en.fallback(Aseini.pull_strings('v1.2.40'))
    # Save a standard file for reference
    strings_en.save('somedir/en.ini')

    # Assume, we translate italian
    strings_it = Aseini.load('somedir/it.ini')
    # A simple way to track translation progress
    translated, total = strings_it.coverage(strings_en)
    print(f'progress: {translated} / {total}')
    # Save as a new file that missing line will be add with '# TODO #' prefix 
    strings_it.save('somedir/it-new.ini', strings_en)
    # Create an alphabet, that all letters used in the value. This is very useful for making fonts
    strings_it.save_alphabet('somedir/it.txt')


if __name__ == '__main__':
    main()

Generated files will be like:

[advanced_mode]
title = 警告 - 重要
description = 您正在進入 “高級模式” 。

[ani_controls]
# TODO # shortcut = Shortcut:
# TODO # right_click = Right-click: Show playback options

[statusbar_tips]
all_layers_are_locked = 所有選擇的圖層都已鎖定
# TODO # layer_locked = Layer '{0}' is locked
# TODO # disable_snap_grid = Disable Snap to Grid
# TODO # frame = Frame:
# TODO # current_frame = Current Frame
# TODO # zoom_level = Zoom Level
# TODO # new_frame = New Frame

Then, just replace the # TODO # line with the correct translation, that’s ok.

There is currently an example to refer to:

If you have any ideas, please let me know

1 Like