GithubHelp home page GithubHelp logo

Comments (4)

erikogan avatar erikogan commented on June 15, 2024

Caveat: This assertion is also based on my misunderstanding of the bug in parse_yaml raised in #17. It may be completely moot once that is fixed.

from serge.

iafan avatar iafan commented on June 15, 2024

I think to address this in the most useful manner (for real-life situations like localizing Ruby-on-Rails apps and allowing to initially import translations from RoR localization files) we could introduce a new yaml_mode option similar to what we have in the XML parser. This setting would have two possible values: generic (default; would fall back to the current behavior) and rails.

In such rails mode:

  1. the parser would ignore the root node name, assuming it's a language name, and exclude it from the built $path value. This would allow us to use path as a key callback value for serge import to work properly (an issue raised in #17);
  2. when constructing the localized YAML file, the parser would replace the name of the root node with the target language name.

from serge.

erikogan avatar erikogan commented on June 15, 2024

Perfect. This is (similar to) what I thought originally, before saying, “I wonder if I can abstract it a bit to make it more generally useful.” But I was likely future-tripping. If a more general form of the yaml_mode needs to be added we can cross that bridge when we come to it.

So in the generic case the key argument passed to the callback would be the whole path, whereas in rails it would trim the locale from the head of the key. That makes sense. I haven’t looked at the code that constructs the localized YAML file, I’ll do that now.

from serge.

erikogan avatar erikogan commented on June 15, 2024

This issue has been resolved by PR #20.

from serge.

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.