wvware / eyes-free

Automatically exported from code.google.com/p/eyes-free
0 stars 1 forks source link

[Eyes-Free Shell] Improve localization of announceTime in AuditoryWidgets.java #83

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I am a Chinese developer. When I use eyesfreeshell to read "Time" in Chinese, 
it 
sounds strange. I suggest using following code to improve the time reading. 
There may be bugs in the code because I am not quite familiar with localization 
in Android and I fail to rebuild eyesfreeshell from source because of missing 
utils.jar (I've made a post in the forum but it's not shown unless the post has 
been authorized)

// **** change following code in announceTime in AuditoryWidgets.java ******
        // original code: String timeStr = Integer.toString(hour) + " " + Integer.toString(minutes) + " " + ampm;
        String timeStr = parent.getString(R.string.localtime, hour, minutes, ampm);
        // add to values/strings.xml: <string name="localtime"><xliff:g id="HOUR">%1$d</xliff:g> <xliff:g id="MINUTES">%2$d</xliff:g> <xliff:g id="AMPM">%3$s</xliff:g></string>
        // add to values-zh-rCN/strings.xml: <string name="localtime">"<xliff:g id="AMPM">%3$s</xliff:g><xliff:g id="HOUR">%1$d</xliff:g>点<xliff:g id="MINUTES">%1$d</xliff:g>分"</string>

        String dateStr = parent.getString(R.string.localdate, monthStr, day);
        // add to values/strings.xml: <string name="localdate"><xliff:g id="MONTH">%1$s</xliff:g> <xliff:g id="DAY">%2$d</xliff:g></string>
        // add to values-zh-rCN/strings.xml: <string name="localdate">"<xliff:g id="MONTH">%1$s</xliff:g>月<xliff:g id="DAY">%2$d</xliff:g>日"</string>        

        String dateTimeStr = parent.getString(R.string.localdatetime, timeStr, dateStr);
        // add to values/strings.xml: <string name="localdatetime"><xliff:g id="TIME">%1$s</xliff:g> <xliff:g id="DATE">%2$s</xliff:g></string>
        // add to values-zh-rCN/strings.xml: <string name="localdatetime">"<xliff:g id="DATE">%2$s</xliff:g><xliff:g id="TIME">%1$s</xliff:g>"</string>        

        // original code: tts.speak(timeStr + " " + monthStr + " " + Integer.toString(day), TextToSpeech.QUEUE_FLUSH, null);
        tts.speak(dateTimeStr, TextToSpeech.QUEUE_FLUSH, null);
// ************** end *********************

Thank you!

Cameron Wong
http://www.eguidedog.net

Original issue reported on code.google.com by hgn...@gmail.com on 30 Jan 2012 at 7:43

GoogleCodeExporter commented 8 years ago

Original comment by alanv@google.com on 27 May 2012 at 5:38

GoogleCodeExporter commented 8 years ago
We should be using xliff here.

Original comment by caseybur...@google.com on 11 Aug 2012 at 10:09