From f76b09e5d5664b56d748968cdbcca1fd6c71f9b3 Mon Sep 17 00:00:00 2001 From: Lars Date: Mon, 30 Dec 2019 19:17:09 +0100 Subject: [PATCH 1/8] Twelveish-10 Wrong capitalization in the German prefixes Fixed wrong capitalization by calpilatizing the words in strings.xml and adding toLowerCase on capitalise2's output. --- .../layoutxml/twelveish/WordClockTask.java | 2 +- app/src/main/res/values/strings.xml | 48 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java index 274da72..eacd581 100644 --- a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java +++ b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java @@ -478,7 +478,7 @@ private String capitalise2(int hours, int minutes, int index) { + middle + ((minutes > 0) ? (SuffixNewLine[index] ? " " : "") : "") + ((showSuffixes) ? ((minutes > 0) ? Suffixes[index] : "") : ""); - return arrangeWords(text); + return arrangeWords(text).toLowerCase(); } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 651eeb5..e516c1a 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -305,30 +305,30 @@ - zwölf - eins - zwei - drei - vier - fünf - sechs - sieben - acht - neun - zehn - elf - zwölf - dreizehn - vierzehn - fünfzehn - sechzehn - siebzehn - achtzehn - neunzehn - zwanzig - einundzwanzig - zweiundzwanzig - dreiundzwanzig + Zwölf + Eins + Zwei + Drei + Vier + Fünf + Sechs + Sieben + Acht + Neun + Zehn + Elf + Zwölf + Dreizehn + Vierzehn + Fünfzehn + Sechzehn + Siebzehn + Achtzehn + Neunzehn + Zwanzig + Einundzwanzig + Zweiundzwanzig + Dreiundzwanzig kurz nach From 768a2426ee28324445bfcc363d598db9a2f5ab91 Mon Sep 17 00:00:00 2001 From: Lars Erik Date: Sun, 3 Jan 2021 22:05:38 +0100 Subject: [PATCH 2/8] Capitalized Viertel in the german translation and de-capitalized hours. --- app/src/main/res/values/strings.xml | 60 ++++++++++++++--------------- build.gradle | 2 +- 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e516c1a..6815408 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -305,42 +305,42 @@ - Zwölf - Eins - Zwei - Drei - Vier - Fünf - Sechs - Sieben - Acht - Neun - Zehn - Elf - Zwölf - Dreizehn - Vierzehn - Fünfzehn - Sechzehn - Siebzehn - Achtzehn - Neunzehn - Zwanzig - Einundzwanzig - Zweiundzwanzig - Dreiundzwanzig + zwölf + eins + zwei + drei + vier + fünf + sechs + sieben + acht + neun + zehn + elf + zwölf + dreizehn + vierzehn + fünfzehn + sechzehn + siebzehn + achtzehn + neunzehn + zwanzig + einundzwanzig + zweiundzwanzig + dreiundzwanzig kurz nach - bald viertel\u00A0nach - fast viertel\u00A0nach - viertel\u00A0nach + bald Viertel\u00A0nach + fast Viertel\u00A0nach + Viertel\u00A0nach bald halb kurz vor halb kurz nach halb - bald viertel\u00A0vor - fast viertel\u00A0vor - viertel\u00A0vor + bald Viertel\u00A0vor + fast Viertel\u00A0vor + Viertel\u00A0vor bald fast diff --git a/build.gradle b/build.gradle index eca7d40..2426268 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.4.1' + classpath 'com.android.tools.build:gradle:4.1.1' // NOTE: Do not place your application dependencies here; they belong From d96de1c6eb0eed0829da0d60b754547bcc9cc623 Mon Sep 17 00:00:00 2001 From: Lars Erik Date: Sun, 3 Jan 2021 22:14:59 +0100 Subject: [PATCH 3/8] Fixes #10 --- .gitignore | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/.gitignore b/.gitignore index f03203d..131d80e 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,92 @@ fastlane/readme.md .idea/workspace.xml___jb_old___ .idea/misc.xml .idea/misc.xml + +# Built application files +*.apk +*.aar +*.ap_ +*.aab + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ +# Uncomment the following line in case you need and you don't have the release build type files in your app +# release/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/assetWizardSettings.xml +.idea/dictionaries +.idea/libraries +# Android Studio 3 in .gitignore file. +.idea/caches +.idea/modules.xml +# Comment next line if keeping position of elements in Navigation Editor is relevant for you +.idea/navEditor.xml + +# Keystore files +# Uncomment the following lines if you do not want to check your keystore files in. +#*.jks +#*.keystore + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild +.cxx/ + +# Google Services (e.g. APIs or Firebase) +# google-services.json + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Version control +vcs.xml + +# lint +lint/intermediates/ +lint/generated/ +lint/outputs/ +lint/tmp/ +# lint/reports/ + +# Android Profiling +*.hprof From 6aca461f6995b7b7aaa8dcfe99d26fcfbb6f3fc3 Mon Sep 17 00:00:00 2001 From: Lars Erik Date: Sun, 3 Jan 2021 22:35:42 +0100 Subject: [PATCH 4/8] Reverted gitignore to LayoutXML version --- .gitignore | 91 +----------------------------------------------------- 1 file changed, 1 insertion(+), 90 deletions(-) diff --git a/.gitignore b/.gitignore index 131d80e..67ec355 100644 --- a/.gitignore +++ b/.gitignore @@ -65,93 +65,4 @@ fastlane/test_output fastlane/readme.md .idea/workspace.xml___jb_old___ .idea/misc.xml -.idea/misc.xml - -# Built application files -*.apk -*.aar -*.ap_ -*.aab - -# Files for the ART/Dalvik VM -*.dex - -# Java class files -*.class - -# Generated files -bin/ -gen/ -out/ -# Uncomment the following line in case you need and you don't have the release build type files in your app -# release/ - -# Gradle files -.gradle/ -build/ - -# Local configuration file (sdk path, etc) -local.properties - -# Proguard folder generated by Eclipse -proguard/ - -# Log Files -*.log - -# Android Studio Navigation editor temp files -.navigation/ - -# Android Studio captures folder -captures/ - -# IntelliJ -*.iml -.idea/workspace.xml -.idea/tasks.xml -.idea/gradle.xml -.idea/assetWizardSettings.xml -.idea/dictionaries -.idea/libraries -# Android Studio 3 in .gitignore file. -.idea/caches -.idea/modules.xml -# Comment next line if keeping position of elements in Navigation Editor is relevant for you -.idea/navEditor.xml - -# Keystore files -# Uncomment the following lines if you do not want to check your keystore files in. -#*.jks -#*.keystore - -# External native build folder generated in Android Studio 2.2 and later -.externalNativeBuild -.cxx/ - -# Google Services (e.g. APIs or Firebase) -# google-services.json - -# Freeline -freeline.py -freeline/ -freeline_project_description.json - -# fastlane -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots -fastlane/test_output -fastlane/readme.md - -# Version control -vcs.xml - -# lint -lint/intermediates/ -lint/generated/ -lint/outputs/ -lint/tmp/ -# lint/reports/ - -# Android Profiling -*.hprof +.idea/misc.xml \ No newline at end of file From 7c3e750b66669528caefe9c7258475cd6e593c1a Mon Sep 17 00:00:00 2001 From: Lars Erik Date: Sun, 3 Jan 2021 22:36:27 +0100 Subject: [PATCH 5/8] Reverted gitignore to LayoutXML version --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 67ec355..f03203d 100644 --- a/.gitignore +++ b/.gitignore @@ -65,4 +65,4 @@ fastlane/test_output fastlane/readme.md .idea/workspace.xml___jb_old___ .idea/misc.xml -.idea/misc.xml \ No newline at end of file +.idea/misc.xml From dfb4c8a7fc08a20a71f15ff35a99bc49bf4bb37a Mon Sep 17 00:00:00 2001 From: Lars Erik Date: Mon, 4 Jan 2021 22:34:07 +0100 Subject: [PATCH 6/8] Fixes issue where some words weren't properly capitalized in Title Case. --- .../com/layoutxml/twelveish/WordClockTask.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java index eacd581..392348f 100644 --- a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java +++ b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java @@ -369,7 +369,19 @@ private String capitalise0(int hours, int minutes, int index) { String mainPrefix = ""; StringBuilder prefix; if ((minutes > 0) && (!Prefixes[index].equals("")) && (Prefixes[index] != null)) { - String[] prefixArray = Prefixes[index].split(" "); + + //We first need to replace unicode spaces with regular spaces + StringBuilder preString = new StringBuilder(); + String[] preArray = Prefixes[index].split("\\u00A0"); + + for (int i = 0; i < preArray.length; i++){ + preString.append(preArray[i]); + preString.append(" "); + } + + // Then we'll separate out the first letter of each word and capitalize it + + String[] prefixArray = preString.toString().split(" "); prefix = new StringBuilder(); for (String word : prefixArray) { if (prefix.length() != 0) From 27e1b856d76a375cb0fd64cb3ce605bcad9a5671 Mon Sep 17 00:00:00 2001 From: Lars Erik Date: Tue, 5 Jan 2021 13:28:31 +0100 Subject: [PATCH 7/8] -Fixed: an issue with word alignment caused by the previous commit. -Fixed: capitalisation for suffixes with non-break spaces --- .../layoutxml/twelveish/WordClockTask.java | 30 ++++++++++++++----- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java index 392348f..976594b 100644 --- a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java +++ b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java @@ -370,16 +370,19 @@ private String capitalise0(int hours, int minutes, int index) { StringBuilder prefix; if ((minutes > 0) && (!Prefixes[index].equals("")) && (Prefixes[index] != null)) { - //We first need to replace unicode spaces with regular spaces + //Split the prefix with non-break spaces and capitalise each word StringBuilder preString = new StringBuilder(); String[] preArray = Prefixes[index].split("\\u00A0"); - for (int i = 0; i < preArray.length; i++){ - preString.append(preArray[i]); - preString.append(" "); + for (String word : preArray){ + if(preString.length() != 0) + preString.append("\u00A0"); + + String capitalised = word.substring(0, 1).toUpperCase() + word.substring(1); + preString.append(capitalised); } - // Then we'll separate out the first letter of each word and capitalize it + // Do the same with spaces String[] prefixArray = preString.toString().split(" "); prefix = new StringBuilder(); @@ -415,8 +418,21 @@ private String capitalise0(int hours, int minutes, int index) { if (showSuffixes) { StringBuilder suffix; if ((minutes > 0) && (!Suffixes[index].equals("")) && (Suffixes[index] != null)) { + + //We first need to replace non-break spaces with regular spaces + StringBuilder suffString = new StringBuilder(); + String[] suffArray = Suffixes[index].split("\\u00A0"); + + for (String word : suffArray){ + if(suffString.length() != 0) + suffString.append("\u00A0"); + + String capitalised = word.substring(0, 1).toUpperCase() + word.substring(1); + suffString.append(capitalised); + } + if (SuffixNewLine[index]) { - String[] suffixArray = Suffixes[index].split(" "); + String[] suffixArray = suffString.toString().split(" "); suffix = new StringBuilder(); for (String word : suffixArray) { if (suffix.length() != 0) @@ -426,7 +442,7 @@ private String capitalise0(int hours, int minutes, int index) { } mainSuffix = suffix.toString(); } else { - mainSuffix = Suffixes[index].toLowerCase(); + mainSuffix = suffString.toString().toLowerCase(); } } } From 083cf35a08d644b6740cc3dbfb559b674840cf07 Mon Sep 17 00:00:00 2001 From: Lars Erik Date: Wed, 10 Feb 2021 21:49:35 +0100 Subject: [PATCH 8/8] Fix german noun capitalisation not working with "First word title case" capitalisation --- app/src/main/java/com/layoutxml/twelveish/WordClockTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java index 976594b..49e224f 100644 --- a/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java +++ b/app/src/main/java/com/layoutxml/twelveish/WordClockTask.java @@ -526,7 +526,7 @@ private String capitalise3(int hours, int minutes, int index) { + middle + ((minutes > 0) ? (SuffixNewLine[index] ? "\n" : "") : "") + ((showSuffixes) ? ((minutes > 0) ? Suffixes[index] : "") : ""); - return text20.substring(0, 1).toUpperCase() + text20.substring(1).toLowerCase(); + return text20.substring(0, 1).toUpperCase() + text20.substring(1); } else { String text20 = ((minutes > 0) ? Prefixes[index] : "") @@ -534,7 +534,7 @@ private String capitalise3(int hours, int minutes, int index) { + middle + ((minutes > 0) ? (SuffixNewLine[index] ? " " : "") : "") + ((showSuffixes) ? ((minutes > 0) ? Suffixes[index] : "") : ""); - return arrangeWords(text20.substring(0, 1).toUpperCase() + text20.substring(1).toLowerCase()); + return arrangeWords(text20.substring(0, 1).toUpperCase() + text20.substring(1)); } }