Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Braille translations for Croatian and Serbian for Google Talkback Braille keyboard #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class BrailleLanguages {
public static final String PRINT_LANGUAGE_AR = "ar";
public static final String PRINT_LANGUAGE_FR = "fr";
public static final String PRINT_LANGUAGE_PL = "pl";
public static final String PRINT_LANGUAGE_HR = "hr";
public static final String PRINT_LANGUAGE_SR = "sr";

/**
* Finds and produces a {@link EditBuffer} based on {@code code}, {@code translatorFactory}, and
Expand Down Expand Up @@ -121,6 +123,30 @@ EditBuffer createEditBuffer(
return new EditBufferPolish(context, translator, talkBack);
}
},
CROATIAN(PRINT_LANGUAGE_HR) {
@Override
public CharSequence getUserFacingName(Resources resources) {
return resources.getString(R.string.code_user_facing_name_hr);
}

@Override
EditBuffer createEditBuffer(
Context context, TalkBackSpeaker talkBack, BrailleTranslator translator) {
return new EditBufferCroatian(context, translator, talkBack);
}
},
SERBIAN(PRINT_LANGUAGE_SR) {
@Override
public CharSequence getUserFacingName(Resources resources) {
return resources.getString(R.string.code_user_facing_name_sr);
}

@Override
EditBuffer createEditBuffer(
Context context, TalkBackSpeaker talkBack, BrailleTranslator translator) {
return new EditBufferSerbian(context, translator, talkBack);
}
},
SPANISH(PRINT_LANGUAGE_ES) {
@Override
public CharSequence getUserFacingName(Resources resources) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2021 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.android.accessibility.braille.common.translate;

import android.content.Context;
import android.content.res.Resources;
import com.google.android.accessibility.braille.common.R;
import com.google.android.accessibility.braille.common.TalkBackSpeaker;
import com.google.android.accessibility.braille.interfaces.BrailleCharacter;
import com.google.android.accessibility.braille.translate.BrailleTranslator;
import java.util.Optional;

/** An EditBuffer for Croatian Braille Grade 1. */
public class EditBufferCroatian extends EditBufferCommon {

public EditBufferCroatian(
Context context, BrailleTranslator ueb1Translator, TalkBackSpeaker talkBack) {
super(context, ueb1Translator, talkBack);
}

@Override
protected Optional<String> getAppendBrailleTextToSpeak(
Resources resources, BrailleCharacter brailleCharacter) {
if (brailleCharacter.equals(BrailleTranslateUtils.NUMERIC)) {
return Optional.of(resources.getString(R.string.number_announcement));
}
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* Copyright 2021 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.google.android.accessibility.braille.common.translate;

import android.content.Context;
import android.content.res.Resources;
import com.google.android.accessibility.braille.common.R;
import com.google.android.accessibility.braille.common.TalkBackSpeaker;
import com.google.android.accessibility.braille.interfaces.BrailleCharacter;
import com.google.android.accessibility.braille.translate.BrailleTranslator;
import java.util.Optional;

/** An EditBuffer for Serbian Braille Grade 1. */
public class EditBufferSerbian extends EditBufferCommon {

public EditBufferSerbian(
Context context, BrailleTranslator ueb1Translator, TalkBackSpeaker talkBack) {
super(context, ueb1Translator, talkBack);
}

@Override
protected Optional<String> getAppendBrailleTextToSpeak(
Resources resources, BrailleCharacter brailleCharacter) {
if (brailleCharacter.equals(BrailleTranslateUtils.NUMERIC)) {
return Optional.of(resources.getString(R.string.number_announcement));
}
return Optional.empty();
}
}
24 changes: 24 additions & 0 deletions braille/common/src/phone/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="number_announcement">Broj</string>
<string name="capitalize_announcement">Veliko slovo</string>
<string name="read_out_deleted">Izbrisano: %s</string>
<plurals name="braille_dots">
<item quantity="one">točke %s</item>
<item quantity="few">točke %s</item>
<item quantity="other">točke %s</item>
</plurals>
<string name="code_user_facing_name_ueb1">Unified English Braille Uncontracted</string>
<string name="code_user_facing_name_ueb2">Unified English Braille Contracted</string>
<string name="code_user_facing_name_es">španjolski</string>
<string name="code_user_facing_name_ar">arapski</string>
<string name="code_user_facing_name_fr">francuski</string>
<string name="code_user_facing_name_pl">poljski</string>
<string name="code_user_facing_name_hr">hrvatski</string>
<string name="code_user_facing_name_sr">srpski</string>
<string name="screen_away">Zaslon prema dolje</string>
<string name="screen_away_detail">Držite uređaj sa zaslonom prema dolje (zaslon prema dolje)</string>
<string name="tabletop">Stolni način</string>
<string name="tabletop_detail">Položite uređaj na stol (stolni način)</string>
<string name="auto_detect">Prilagodite načinu na koji držite uređaj</string>
</resources>
24 changes: 24 additions & 0 deletions braille/common/src/phone/res/values-sr/strings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="number_announcement">Број</string>
<string name="capitalize_announcement">Велико слово</string>
<string name="read_out_deleted">Избрисано: %s</string>
<plurals name="braille_dots">
<item quantity="one">тачке %s</item>
<item quantity="few">тачке %s</item>
<item quantity="other">тачке %s</item>
</plurals>
<string name="code_user_facing_name_ueb1">Обједињена енглеска брајева азбука без скраћеница</string>
<string name="code_user_facing_name_ueb2">Обједињена енглеска брајева азбука са скраћеницама</string>
<string name="code_user_facing_name_es">шпански</string>
<string name="code_user_facing_name_ar">арапски</string>
<string name="code_user_facing_name_fr">француски</string>
<string name="code_user_facing_name_pl">пољски</string>
<string name="code_user_facing_name_hr">хрватски</string>
<string name="code_user_facing_name_sr">српски</string>
<string name="screen_away">Режим рада са екраном надоле</string>
<string name="screen_away_detail">Држите уређај тако да екран буде окренут од вас (режим рада са екраном надоле)</string>
<string name="tabletop">Стони режим</string>
<string name="tabletop_detail">Поставите уређај равно на сто (стони режим)</string>
<string name="auto_detect">Прилагодите начину на који држите уређај</string>
</resources>
4 changes: 4 additions & 0 deletions braille/common/src/phone/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
<string name="code_user_facing_name_fr">French</string>
<!-- Language list preference item for the Polish language. [CHAR_LIMIT=40] -->
<string name="code_user_facing_name_pl">Polish</string>
<!-- Language list preference item for the Croatian language. [CHAR_LIMIT=40] -->
<string name="code_user_facing_name_hr">Croatian</string>
<!-- Language list preference item for the Serbian language. [CHAR_LIMIT=40] -->
<string name="code_user_facing_name_sr">Serbian</string>


<!-- Layout Options -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ public BrailleTranslator create(Context context, String codeName) {
if (codeName.equals("FRENCH")) {
return new LibLouisTranslatorFrench(context);
}
if (codeName.equals("CROATIAN")) {
return new LibLouisTranslatorCroatian(context);
}
if (codeName.equals("SERBIAN")) {
return new LibLouisTranslatorSerbian(context);
}
if (codeName.equals("POLISH")) {
return new LibLouisTranslatorPolish(context);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.google.android.accessibility.braille.translate.liblouis;

import android.content.Context;

class LibLouisTranslatorCroatian extends LibLouisTranslator {

LibLouisTranslatorCroatian(Context context) {
super(context, "hr-g1.tbl");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.google.android.accessibility.braille.translate.liblouis;

import android.content.Context;

class LibLouisTranslatorSerbian extends LibLouisTranslator {

LibLouisTranslatorSerbian(Context context) {
super(context, "sr.tbl");
}
}
Loading