aboutsummaryrefslogtreecommitdiff
path: root/subsonic-main/src/test/java/net/sourceforge/subsonic/MissingTranslations.java
blob: cf3dbc6c3085e16392525ab18da95a6a9fc9ff4d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package net.sourceforge.subsonic;

import java.io.*;
import java.util.*;

public class MissingTranslations  {

    public static void main(String[] args) throws IOException {
        String[] locales = {"da", "de", "es", "pt", "fi", "fr", "is", "it", "ja_JP", "mk", "nl", "no", "pl", "ru", "sl", "sv", "zh_CN", "zh_TW"};

        for (String locale : locales) {
            diff(locale, "en");
        }
    }

    private static void diff(String locale1, String locale2) throws IOException {
        Properties en = new Properties();
        en.load(MissingTranslations.class.getResourceAsStream("/net/sourceforge/subsonic/i18n/ResourceBundle_" + locale1 + ".properties"));
        SortedMap<Object,Object> enSorted = new TreeMap<Object, Object>(en);

        Properties mk = new Properties();
        mk.load(MissingTranslations.class.getResourceAsStream("/net/sourceforge/subsonic/i18n/ResourceBundle_" + locale2 + ".properties"));

        System.out.println("\nMessages present in locale " + locale1 + " and missing in locale " + locale2 + ":");
        int count = 0;
        for (Map.Entry<Object, Object> entry : enSorted.entrySet()) {
            if (!mk.containsKey(entry.getKey())) {
                System.out.println(entry.getKey() + " = " + entry.getValue());
                count++;
            }
        }

        System.out.println("\nTotal: " + count);
    }
}