Code Monkey home page Code Monkey logo

Comments (13)

adrai avatar adrai commented on June 16, 2024 1

Thanks for the info.
locize does only save the individual keys, not the original fil.
This is the reason all additional tags etc. are not there anymore.
Will investigate if there is something we can do for this.

from locize-cli.

SalvatoreT avatar SalvatoreT commented on June 16, 2024

I'm not super concerned about the XML comment tags, but I do use the <xliff:g> placeholder tag to mark parts of the string so they're not translated.

Thanks for looking into this! I'm currently blocked by this, so if you have something in a beta I'd be happy to try it. I'm hitting a similar issue when I try to upload the string file to the site.

Screen Shot 2020-04-28 at 11 57 53 PM

from locize-cli.

adrai avatar adrai commented on June 16, 2024

There is perhaps a chance to handle this like this:

  <string name="star_rating">
    Check out our 5
    <xliff:g id="star">\u2605</xliff:g>
  </string>
{
  "star_rating": "Check out our 5\n    <xliff:g id=\"star\">\\u2605</xliff:g>"
}

But it will just work if there is 1 xliff:g in the sentence

Would this be ok for you?

from locize-cli.

adrai avatar adrai commented on June 16, 2024

If you like, you can try v7.1.3

from locize-cli.

SalvatoreT avatar SalvatoreT commented on June 16, 2024

Thanks for taking a swing at it. Unfortunately, I still can upload my strings.

I found another library that might help with the Android parsing and opened an issue with the suggestion. locize/android-string-resource#2

from locize-cli.

adrai avatar adrai commented on June 16, 2024

will have another investigation...

from locize-cli.

SalvatoreT avatar SalvatoreT commented on June 16, 2024

If you like, you can try v7.1.3

Looks like we're making progress. This part of the resource isn't getting preserved: <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">.

Also, all the string keys are changing which will be a problem when trying to use the translated versions with different keys.

-  <resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-  <!-- Example placeholder for a special unicode symbol -->
-  <string name="star_rating">Check out our 5
-    <xliff:g id="star">\u2605</xliff:g>

+ <?xml version="1.0" encoding="utf-8"?>
+ <resources>
+   <string name="app_homeurl.value">
+     Visit us at
+     <xliff:g id="application_homepage">http://my/app/home.html</xliff:g>

  </string>

-  <!-- Example placeholder for a for a URL -->
-  <string name="app_homeurl">
-    Visit us at <xliff:g
-    id="application_homepage">http://my/app/home.html</xliff:g>

+  <string name="prod_name.value">
+    Learn more at
+    <xliff:g id="prod_gamegroup">Game Group</xliff:g>

  </string>

-  <!-- Example placeholder for a name -->
-  <string name="prod_name">
-    Learn more at <xliff:g id="prod_gamegroup">Game Group</xliff:g>

+  <string name="promo_message.value">
+    <![CDATA[Please use the &quot;]]>
+    <xliff:g id="promotion_code">ABCDEFG</xliff:g>

  </string>

-  <!-- Example placeholder for a literal -->
-  <string name="promo_message">
-    Please use the "<xliff:g id="promotion_code">ABCDEFG</xliff:g>" to get a discount.

+  <string name="star_rating.value">
+    Check out our 5
+    <xliff:g id="star">\u2605</xliff:g>

  </string>

- </resources>

+ </resources>

reformatting /private/tmp/android-docs.xml...
would have reformatted /private/tmp/android-docs.xml...
FINISHED

from locize-cli.

adrai avatar adrai commented on June 16, 2024

next try with v7.1.4
key order can't be preserved

from locize-cli.

SalvatoreT avatar SalvatoreT commented on June 16, 2024

We're getting closer!

The resource tag was still clobbered a bit.

<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">

became

<?xml version="1.0" encoding="utf-8" xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"?>
<resources>

Also, all the string keys gain a .value in their name.

from locize-cli.

adrai avatar adrai commented on June 16, 2024

xmlns:xliff is fixed now,
the .value was because of a bug in the format command

v7.1.5

from locize-cli.

SalvatoreT avatar SalvatoreT commented on June 16, 2024

This is much better!

The only nit I have is that the <xliff:g> tags are moved to the start of their own line. I'm not 100% if that will cause a problem or not.

-  <string name="app_homeurl">Visit us at <xliff:g id="application_homepage">http://my/app/home.html</xliff:g>

+  <string name="app_homeurl">Visit us at
+    <xliff:g id="application_homepage">http://my/app/home.html</xliff:g>

from locize-cli.

adrai avatar adrai commented on June 16, 2024

I think this will be ok... but I'm not an android expert ;-)

from locize-cli.

SalvatoreT avatar SalvatoreT commented on June 16, 2024

Thanks for fixing this issue!

from locize-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.