atorch / probability_puzzles

Android App
GNU General Public License v3.0
36 stars 5 forks source link

Translation into Hebrew #20

Open Roymaor01 opened 2 years ago

Roymaor01 commented 2 years ago

1.I can translate the app to hebrew, if you'd like. Please inform me how to continue. Note that the app should be compatible to right-to-left text display

  1. Using the app now, the text insertion is going from right to left , making the answers i type look unarrenged (but correct).
atorch commented 2 years ago

That would be wonderful, thank you for offering. The app has already been translated into German -- I'll post some links here showing how that was done:

atorch commented 2 years ago

https://developer.android.com/training/basics/supporting-devices/languages is also helpful:

Some users choose a language that uses right-to-left (RTL) scripts, such as Arabic or Hebrew, for their UI locale.

There's a lot of info there about RTL layout mirroring, etc.

atorch commented 2 years ago

And here's the pull request that added the German translation: https://github.com/atorch/probability_puzzles/pull/7. Notice that the MR is mainly adding the values-de/strings.xml file.

Roymaor01 commented 2 years ago

Last year i translated another app using this site: https://crowdin.com/ Are you familiar with it? I am new to github. How do i open a foldet? Should i fork/pull ? Am i a contributor? Can i add a new file?

atorch commented 2 years ago

Yes, you'll want to fork and then open a PR into this repo (from the feature branch in your repo to the main/master branch in this repo). See https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

atorch commented 2 years ago

If you click on the link to the German translation PR, you'll see it says atorch merged 4 commits into atorch:master from rillig:master -- you'll do something very similar for your PR adding a new Hebrew strings xml file

rillig commented 2 years ago

@Roymaor01 The GitHub workflow is terribly complicated when you are new to GitHub and Git and all this stuff. I agree that Crowdin is much more human-friendly.

@atorch Since Crowdin is free for public projects, maybe that's the way to go.

@Roymaor01 For translating the App using GitHub, the basic workflow is:

  1. You "fork" this project, thereby creating your own "working copy" of it, where you can freely make any changes you like.
  2. In your fork of the project, you copy the file app/src/main/res/values/strings.xml (containing the English messages) to app/src/main/res/values-he/strings.xml (the he in the directory name stands for Hebrew).
  3. You can then edit this file in the browser, using the GitHub website.
  4. Whenever you save some changes, you briefly describe what you did in the 'Commit message' field.
  5. If you are unsure about anything, just ask.
  6. When you are finished or have any further questions, just tell us, we will then guide you through the remaining steps.
Roymaor01 commented 2 years ago

Thanks for your instructions. I followed steps 1-4 and made some translations and saved/commited the changes in a new file. Now I want to check how it is seen in the app before continuing with the translation. Can you kindly explain me how to do it: do i have to compile the app? do i need another software? Do i need to ask for a push?

atorch commented 2 years ago

Good question! There are a few ways to make sure everything is working correctly:

When you open an MR like https://github.com/atorch/probability_puzzles/pull/25 (note that I changed the target branch to https://github.com/atorch/probability_puzzles/tree/hebrew instead of master), github will automatically run an action/check/workflow that tries to build the app and tells you if there are any errors. See https://github.com/atorch/probability_puzzles/pull/25/checks. In this case, the check failed (you'll see a red checkmark), with the following error:

ERROR:/home/runner/work/probability_puzzles/probability_puzzles/app/src/main/res/values-he/strings.xml:10:5-40:20: AAPT: error: resource attr/עבודה טובה! מוכנים לחידה נוספת (aka atorch.statspuzzles:attr/עבודה טובה! מוכנים לחידה נוספת) not found.

So there's something about the syntax in line number 10 (I think that's https://github.com/atorch/probability_puzzles/blob/hebrew/app/src/main/res/values-he/strings.xml#L11) that is causing an error, although it isn't immediately obvious to me what is wrong. Maybe the question mark at the beginning of the string needs to be replaced with a special character? I'll see what I can find online.

The github check is nice because it runs automatically. To go deeper, you'd need to install something like https://developer.android.com/studio and inspect the code and error messages there. That's a lot of work, so if you open MRs pointing to this repo, I can load them into android studio and let you know what I see. Here's a screenshot:

Screenshot from 2022-08-08 17-58-27

atorch commented 2 years ago

@Roymaor01 let's see whether we get a green or red check mark when the github check tries to build the app in https://github.com/Roymaor01/probability_puzzles/pull/1

You'll have to click approve in order for the check to run (because I'm a first time contributor to your copy of the repo)

Screenshot from 2022-08-08 18-21-21

If we get a green check mark, that'll tell us that the ? at the beginning of that sentence was causing an issue -- we can ignore it for now, and figure out how to make question marks work correctly in values-he in the future.

rillig commented 2 years ago

The error is indeed due to the question mark. When using a question mark at the beginning of a string, it must be written as \? instead. A plain ? at the beginning of a string means a reference to a style, which is a feature that we don't need in this app.